Hi,
I am trying to bind a unbound column to a visibility property in the MVVM format, looks like it doesn't work. Can I not bind the visibility of the unbound field?
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.Fields> <igDP:UnboundField Name="View" Visibility="{Binding ViewVisible}"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowResize="False" AllowGroupBy="False" AllowRecordFiltering="False" AllowSummaries="False" LabelTextAlignment="Center" Width="75" CellValuePresenterStyle="{StaticResource CellButtonStyle}"/> </igDP:UnboundField.Settings> </igDP:UnboundField></igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts>
Hello Arpita,
Thank you for your post. I have been looking into the behavior that you are having and the reason for the Binding for the Visibility property of the Fields and UnboundFields to not work is that you are using binding, which does not have a Source defined. The Field and UnboundField classes are not actually a visual elements. Since the Field and the UnboundField does not derives from the FrameworkElement class, they does not expose a DataContext property. In order to bind the properties of those two classes, you can use the Source property of the binding. You can define an instance of your View Model in the Resources of the Window and to use that object to bind the Visibility properties of the Fields. I have created a sample application for you, that shows how you can implement this approach.
Please let me know if I can assist you with anything else.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
I need to bind the label on UnboundField in xamdatagrid like:
igDP:UnboundField Label="{Binding abc[0]}"
where abc is an ObservableCollection. But its not showing anything in the lable. Please help.
Thanks :)