In the code below, the no breakpoints in the converter are ever hit. Clicking on the radio buttons doesn’t do anything to change the active control. It’s like the IsChecked doesn’t even trigger a change event. Any ideas? This is WinRT code.
<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>
I was unable to declare any binding in the RadioButton.IsChecked. However, I did get this to work just fine through inverting the problem. There’s an IsSelected property on FlipViewItem. I succeeded with this kind of approach: