So in a ListView I can do the following and in my View Model it would set the IsRowSelected property for each object when the row is selected. How can I do this with a RadGridView? We are using MVVM pattern and are trying to have little to no code in the xaml code behind.
Thanks
Thanks
| <Style x:Key="RowItemStyle" TargetType="{x:Type ListViewItem}"> |
| <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
| <Setter Property="IsSelected" Value="{Binding Path=IsRowSelected, Mode=TwoWay}" /> |
| <Style.Triggers> |
| <MultiTrigger> |
| <MultiTrigger.Conditions> |
| <Condition Property="ItemsControl.AlternationIndex" Value="1" /> |
| <Condition Property="IsSelected" Value="False" /> |
| <Condition Property="IsMouseOver" Value="False" /> |
| </MultiTrigger.Conditions> |
| <Setter Property="Background" Value="#EEEEEEEE" /> |
| </MultiTrigger> |
| </Style.Triggers> |
| </Style> |
| <ListView |
| Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" |
| MaxHeight="200" |
| ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" |
| ItemContainerStyle="{StaticResource RowItemStyle}" |
| ItemsSource="{Binding Path=MasterList}" IsSynchronizedWithCurrentItem="True" |
| SelectionMode="Single" |
| > |
| <ListView.View> |
| <GridView> |
| <GridViewColumn Header="Item Name" Width="Auto" DisplayMemberBinding="{Binding Path=ItemName}" /> |
| </GridView> |
| </ListView.View> |
| </ListView> |