Steven Miles has been formally elected by the Labor Party to be the opposition leader.