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;
DataSource="{Binding Path=ImportData}">
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:DataRecordPresenter}">
Value="{Binding Path=DataItem.ExistsAtTarget, Converter={StaticResource visibilityValueConverter}}"/>
</Style>
</igDP:XamDataGrid.Resources>
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!
I've never tried setting rows to be collapsed. Assuming it's possible (although I'd think you'd want to filter the data source), could you post the converter code for review?
Hi,
public class BooleanToVisibilityValueConverter : IValueConverter
{
#region IValueConverter Members
}
else
#endregion
Also, I tried setting the record visibility in the XamDataGrid.InitializeRecrod event handler, but that crashed by entire application...(at least when all my records were set to Collapsed)