Uisnga DataTrigger隐藏Xceed数据网格行

时间:2019-05-10 00:09:26

标签: wpf xceed-datagrid

我正在WPF MVVM项目上工作,我有一个ObservableCollection,其类包含布尔属性和字符串属性。该Observablecollection绑定xceedwpfgrid。我试图添加一个数据触发器来检查布尔值,并基于该属性显示或隐藏行。我尝试了一些尝试,但是我无法通过xceedgrid上的数据触发器来帮助我。

          <TreeGrid:XceedColumnBindingGrid ItemsSource="{Binding Path=.DataList}"                                                 
                                            AutoCreateColumns="False"                                                
                                            IsTabStop="False" 
                                            SelectedItem="{Binding Path=.SelectedItem}"
                                            ContextMenuBuilder="{Binding Path=.ContextMenuBuilder}">


              <TreeGrid:XceedColumnBindingGrid.Resources>
                <Style TargetType="{x:Type DataGridRow}" >
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=.DataList.IsOnExclusionList}" Value="true">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>

                        <DataTrigger Binding="{Binding Path=.DataList.IsOnExclusionList}" Value="false">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>

                </Style>
                 </TreeGrid:XceedColumnBindingGrid.Resources>
            <TreeGrid:XceedColumnBindingGrid.Columns>
                <xcdg:Column FieldName="IsOnExclusionList" Title="IsOnExclusionList" Width="30" CellContentTemplate="{StaticResource cellCashDeliveringTemplate}" CellEditorDisplayConditions="None"/>
                <xcdg:Column FieldName="Name" Title="Name" Width="30" CellContentTemplate="{StaticResource cellCashDeliveringTemplate}" CellEditorDisplayConditions="None"/>
            </TreeGrid:XceedColumnBindingGrid.Columns>
        </TreeGrid:XceedColumnBindingGrid>

我希望datatrigger能够显示和隐藏依布尔变量而定的行

0 个答案:

没有答案