Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
700
is it possible to bind row visibility?
posted

hello, 

i would like to be able to hide/show rows based on underlying data property. 

Let's say i bind the grid to Customer.IsVisibible., and i bind the grid to ObservableCollection<Customer>.. 

 

how can i bind row visibility to Customer.IsVisible? 

 

thanks. 

Parents
No Data
Reply
  • 34510
    Verified Answer
    Offline posted

    Hi Squarewave24,

    You can use a style targeting the DataRecordPresenter to do this.  Using a DataTrigger you can watch for the IsVisible property in your data item and when it is False you can set the height of the DataRecordPresenter to zero.  The style looks like this:

    <Style x:Key="dataRecordPresenter" TargetType="{x:Type igDP:DataRecordPresenter}">
     <Style.Triggers>
      <DataTrigger Binding="{Binding Path=DataItem.IsVisible}" Value="False">
       <Setter Property="Height" Value="0"/>
      </DataTrigger>
     </Style.Triggers>
    </Style>

    Using the style works as follows:

    <igDP:XamDataGrid>
     <igDP:XamDataGrid.FieldLayoutSettings>
      <igDP:FieldLayoutSettings DataRecordPresenterStyle="{StaticResource dataRecordPresenter}"/>
     </igDP:XamDataGrid.FieldLayoutSettings>
    </igDP:XamDataGrid>

    Let me know if you have any questions.

Children