Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

how to select listitem on selecting radio button in wpf

$
0
0
<ListView BorderThickness="0"  SelectedItem="{Binding  Path=Description}"
                      ItemsSource="{Binding Descriptions, Mode=TwoWay}" Margin="2"><ListView.ItemTemplate><DataTemplate><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="23"/><ColumnDefinition Width="5"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><RadioButton VerticalAlignment="Center" Name="rb" Grid.Column="0" GroupName="A" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListViewItem}}"><RadioButton.Content><TextBlock VerticalAlignment="Center" Grid.Column="2" Text="{Binding Path=Version}"/></RadioButton.Content></RadioButton></Grid><DataTemplate.Triggers><DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListViewItem}}, Path=IsSelected}" Value="True"><Setter TargetName="rb" Property="IsChecked" Value="true"/></DataTrigger></DataTemplate.Triggers></DataTemplate></ListView.ItemTemplate></ListView>
hi , i want that  when i select radio button then listitem should also get selected ,now i am getting null exception with this code


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>