在下面的代码中,转换器中没有遇到断点。单击单选按钮不会更改活动控件。这就像 IsChecked 甚至不会触发更改事件。有任何想法吗?这是 WinRT 代码。
<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>