在下面的代码中,转换器中没有断点。单击单选按钮不会做任何事情来更改活动控件。这就像IsChecked甚至不会触发更改事件。有任何想法吗?这是WinRT代码。试图使用WinRT绑定到IsChecked
<Page
x:Class="TestBinding.MainPage"
IsTabStop="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TestBinding"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<local:EqualsToBoolConverter x:Key="equalsToBoolConverter"/>
</Page.Resources>
<Page.TopAppBar>
<AppBar IsOpen="True" IsSticky="True">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<RadioButton
Style="{StaticResource TextRadioButtonStyle}"
Name="goItem1"
IsChecked="{Binding ElementName=flipView,Path=SelectedItem,Converter={StaticResource equalsToBoolConverter}, ConverterParameter={Binding ElementName=item1}, Mode=TwoWay}">Go 1</RadioButton>
<RadioButton
Style="{StaticResource TextRadioButtonStyle}"
Name="goItem2"
IsChecked="{Binding ElementName=flipView,Path=SelectedItem,Converter={StaticResource equalsToBoolConverter}, ConverterParameter={Binding ElementName=item2}, Mode=TwoWay}">Go 2</RadioButton>
</StackPanel>
</AppBar>
</Page.TopAppBar>
<FlipView
Name="flipView"
Background="{StaticResource ApplicationPageBackgroundThemeBrush}"
Margin="100"
Padding="10"
SelectedIndex="0">
<FlipViewItem Name="item1">
<TextBlock Text="item1"/>
</FlipViewItem>
<FlipViewItem Name="item2">
<TextBlock Text="item2"/>
</FlipViewItem>
</FlipView>
</Page>
它可以帮助看看调试输出面板。绑定错误将在那里报告。 – ollb 2012-08-03 08:45:17
调试输出面板中不报告绑定错误。这是WinRT,他们有问题。 – Brannon 2012-08-03 16:19:45
你检查了吗?我每天使用WinRT + C++/CX工作,调试输出通常有助于指向正确的方向,当绑定错误或绑定类型不匹配时等。WinRT似乎有一个默默的习惯忽略绑定的异常/问题并仅通过调试输出报告它们(至少在C++/CX中)。所以这通常是我看到的第一个地方,当绑定似乎不起作用或转换器不能执行时。也许你还应该发布转换器源代码? – ollb 2012-08-03 17:32:05