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
745
How to set record visibility?
posted

Hi guys!

Does anyone know how to set the Visibility of a record in the XamDataGrid using data binding?

What I want to do is bind a collection of objects to the grid, and using a property on the object to determine if the record should be visible or collapsed.
I have tried creating a style for the DataRecordPresenter where I set the Visibility using data binding like this;

<igDP:XamDataGrid x:Name="xamDataGridImportData" GroupByAreaLocation="None"

DataSource="{Binding Path=ImportData}">

<igDP:XamDataGrid.Resources>

<Style TargetType="{x:Type igDP:DataRecordPresenter}">

<Setter Property="Visibility"

Value="{Binding Path=DataItem.ExistsAtTarget, Converter={StaticResource visibilityValueConverter}}"/>

</Style>

</igDP:XamDataGrid.Resources>

 

</igDP:XamDataGrid>

 I have verified that the data binding actually occurs for each item (by setting a break point in the ValueConverter), but when the grid is rendered, every record is visible even if they shouldn't be...

Any ideas? Am I doing this all wrong?
I know I can do this in code, but I would like to do it in XAML if it's possible...

Thanks! 

 

 

 

Parents
No Data
Reply
  • 6867
    Verified Answer
    posted

    Hi,

    I checked this out in Mole.  It seems that the Visibility of the DataRecordPresenter is set to 'Visible' as a "local" value, meaning that value will take precendence over a value supplied by Setters/Styles/Triggers/etc.  I'm not sure if that is a bug or not, but it certainly will block you from being able to filter out the rows using the XAML-only approach you've described.  You can bring this up with our Developer Support group and see what the Engineering team can do about it.  In the meanwhile, you'll need to write code to hide the records.  Or, you can bind the grid to a filtered list of objects, so that hiding them is not necessary at all.

    Josh

Children