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

We are trying to develop a grid whose AllowEdit property for field settigs depends on some runtime values. It seems that almost any kind of binding fails. We have tried:

AllowEdit="{Binding ElementName=parentUserControlName, Path=IsEditAllowed} "

and 

AllowEdit="{Binding IsEditAllowed}" after setting the User Control's DataContext to "this". 

Both times we get the error:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=IsEditAllowed; DataItem=null; target element is 'FieldSettings' (HashCode=15935451); target property is 'AllowEdit' (type 'Nullable`1')

 

However, if we set the Binding Source to be an x:Static, it works. For example:

AllowEdit="{Binding Path=IsEditAllowed, Source={x:Static  Sample:EntitlementsProvider.Instance}}" it works fine!!!

I know that FieldSettings is just a DependencyObject, not a framework element, but if anyone could explain why this is happening and what workarounds we can do to dynamically set the AllowEdit property in a consistent and extensible manner, please let me know.

Thanks,

-Szymon

 

Parents Reply Children
No Data