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
2915
Binding XamDataGrid UnboundField Visibility
posted

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>

Parents
  • 30945
    Offline posted

    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

    FieldVisibilityBinding.zip
Reply Children
No Data