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 AllowAddNew AllowDelete in FieldLayout Settings
posted

I want to bind AllowAddNew and AllowDelete in the FieldLayout Settings because their true/false values will depend on some values, say AllowEditData in the VM.

Any suggestions?

Parents
  • 34430
    Offline posted

    Hello InfraNewbie,

    Unfortunately, it is not currently possible to 'directly' bind to a path in your ViewModel from the FieldLayoutSettings object. This is because the FieldLayoutSettings element does not derive from FrameworkElement and so does not expose a DataContext property, and so a direct Binding path will not work here - you will need a source.

    The best recommendation I can make in this case is to bring your ViewModel into your XAML as a keyed resource. In doing so, you can set up a binding like the following, where "AllowAddNew" is a bool property on the ViewModel, which has a key of "VM" in this case:

    AllowAddNew="{Binding Source={StaticResource VM} Path=AllowAddNew}"

    I have attached a sample project to demonstrate the above. I hope this helps.

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

    Sincerely,
    Andrew
    Associate Developer

    XDGBindSettingsCase.zip
Reply Children