Hi all,
I have a window following:
Image may be NSFW.
Clik here to view.
Here is my code:
Viewmodel file:
CollectionView= new ListCollectionView(listItem); CollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Name"));
View file:
<Style x:Key="ColumnHeaderStype" TargetType="{x:Type DataGridColumnHeader}"><Setter Property="FontWeight" Value="Bold" /><Setter Property="HorizontalAlignment" Value="Stretch" /><Setter Property="HorizontalContentAlignment" Value="Center" /><Setter Property="BorderBrush" Value="#C3C3C3" /><Setter Property="BorderThickness" Value="1" /><Setter Property="Background" Value="#919191" /><Setter Property="MinHeight" Value="25" /></Style><!--Datagrid Group Header Style--><Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}"><Setter Property="Background" Value="#FFFFFF" /><Setter Property="MinHeight" Value="25" /><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type GroupItem}"><Expander IsExpanded="True" Template="{StaticResource SimpleExpanderTemp}" OverridesDefaultStyle="True"> <Expander.Header><StackPanel Orientation="Horizontal"><CheckBox IsChecked="{Binding Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" IsThreeState="True" /><TextBlock Text="{Binding Path=Name}" VerticalAlignment="Center" FontWeight="Bold" Margin="5,5,0,7" /></StackPanel></Expander.Header><ItemsPresenter /></Expander></ControlTemplate></Setter.Value></Setter></Style>
<DataGrid Name="gridTestCase" Grid.Row="1" ItemsSource="{Binding CollectionView}" AutoGenerateColumns="False" Margin="5" CanUserReorderColumns="False" CanUserResizeColumns="True" CanUserAddRows="False" HeadersVisibility="Column" Background="White"> . . .</DataGrid>
I want to change status of checkbox in Group when the child checkbox's status is changed.
I binding a property "IsChecked" for checkbox in expander but the CollectionView don't understand this property.
So please help me to solve this problem.
Thanks and regards,
Hien Su
Sugia279 Don't try don't future