Dimitris
Dimitris

Reputation: 755

EventToCommandBehavior Namespace prefix 'b' is not defined

I'm trying to create an example from "Using the EventToCommandBehavior" (Prism Docs) I'm getting a compilation error "Namespace prefix 'b' is not defined." and a red squiggly line bellow the "b" in the following line

<b:EventToCommandBehavior EventName="ItemTapped" Command="{Binding ItemTappedCommand}" />

The XAML Page is very simple as it is an example and look like this:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
             prism:ViewModelLocator.AutowireViewModel="True"
             x:Class="Intro.Views.Example03"
             x:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
             Title="{Binding Title}">
  <StackLayout>
    <ListView.Behaviors>
      <b:EventToCommandBehavior EventName="ItemTapped" Command="{Binding ItemTappedCommand}" />
    </ListView.Behaviors>
  </StackLayout>
</ContentPage>

What am I doing wrong?

Upvotes: 0

Views: 1093

Answers (1)

Stephane Delcroix
Stephane Delcroix

Reputation: 16232

x:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"

should be

xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms" 

Upvotes: 2

Related Questions