我试图从"使用EventToCommandBehavior"创建一个示例。 (棱镜文件) 我收到了编译错误"命名空间前缀' b'没有定义。" " b"以及一条红色的波浪线。在以下一行
<b:EventToCommandBehavior EventName="ItemTapped" Command="{Binding ItemTappedCommand}" />
XAML页面非常简单,因为它是一个示例,如下所示:
<?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>
我做错了什么?
答案 0 :(得分:3)
x:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
应该是
xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"