【发布时间】:2011-09-22 20:24:39
【问题描述】:
在一个 Windows Phone 7 项目中,我正在使用如下所示的 XAML;
<phone:PhoneApplicationPage.Resources>
<ValueConverters:FuelTypeEnumToRadioButtonConverter x:Name="fuelConverter" />
</phone:PhoneApplicationPage.Resources>
在我的页面上,我正在这样使用它:
<RadioButton IsChecked="{Binding PreferredFuel, Mode=TwoWay, ConverterParameter=Blyfri95, Converter={StaticResource fuelConverter}}" Content="Blyfri 95" Height="72" HorizontalAlignment="Left" Margin="-1,276,0,0" Name="radioButton1" VerticalAlignment="Top" GroupName="FuelType" />
<RadioButton IsChecked="{Binding PreferredFuel, Mode=TwoWay, ConverterParameter=Blyfri98, Converter={StaticResource fuelConverter}}" Content="Blyfri 98" Height="72" HorizontalAlignment="Left" Margin="154,276,0,0" Name="radioButton2" VerticalAlignment="Top" GroupName="FuelType" />
<RadioButton IsChecked="{Binding PreferredFuel, Mode=TwoWay, ConverterParameter=Diesel, Converter={StaticResource fuelConverter}}" Content="Diesel" Height="72" HorizontalAlignment="Left" Margin="308,276,0,0" Name="radioButton3" VerticalAlignment="Top" GroupName="FuelType" />
这在实际应用程序中一切正常,但 Visual Studio 中的 XAML 编辑器抱怨“无法在此范围内注册重复名称 'fuelConverter'”。我必须注释掉最初的 Resource-line 才能让 XAML 设计器在 Visual Studio 2010 中工作(但是当我运行它时应用程序不起作用)。
其他人看到了吗?这只是 XAML 设计器的错误吗?
【问题讨论】:
标签: xaml windows-phone-7