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
210
Binding to AllowEdit property of the Field Settings
posted

As far as I know, binding to AllowEdit property of the Field Settings is not supported.

But what are the best workarounds?

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello InfraNewbie,

    You had a very similar question asked at the following forum thread, which I had answered: https://www.infragistics.com/community/forums/p/110483/519186.aspx#519186. The FieldSettings element, like the FieldLayoutSettings element, is not a derivation of FrameworkElement and so cannot directly be bound, and so my best recommendation in this case would be to bring your ViewModel in as a resource and bind using it as a StaticResource as shown in the sample project on the linked forum thread.

    It is worth noting, that each Field element in the XamDataGrid does have an AllowEdit property of its own. While these Field elements are not FrameworkElements either, they do have a route back to the owning FieldLayout, which has a route back to the XamDataGrid, unlike the FieldSettings and FieldLayoutSettings. If you set up a binding like the following on your Field, you may be able to bind to your XamDataGrid's data context:

    <Field AllowEdit="{Binding RelativeSource={RelativeSource Self}, Path=Owner.DataPresenter.DataContext.PropertyName}" />

    Breaking this binding down, the RelativeSource Self binds back to the Field object. The Field has an Owner property that returns the FieldLayout, which has a DataPresenter property returning the XamDataGrid. Assuming the DataContext of the XamDataGrid is the element containing your property that you wish to bind to, this route would work to bind your Field's AllowEdit properties to a property on your view model.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

Children
No Data