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
329
Binding Field Visibility
posted

I have a XamDataPresenter inside a UserControl.  I want the visibility of one of the Fields to change based on the value of a property in the user control.  I can set the visibility of the Field in the code behind, but what I really want to do is bind the Visibility property of the Field to the UserControl property.  For example:

<igDP:Field Name="MyField" Label="My Feild" Visibility="{Binding Path=MyFieldVisibility, ElementName=contentBase, Mode=Default}"/>

"contentBase" is the name of the UserControl.  I use this same code to bind the Visibility property of other controls in the UserControl and it works.  Is it not possible to bind the Visibility property of a Field, or am I missing something?

John Myczek

  • 8576
    Verified Answer
    Offline posted
    Hi John -
     
    Since the Field object is not a FrameworkElement or a FrameworkContentElement, the WPF framework does not allow it to be the target of a binding (though it can be the source of a binding).
     
    Unfortunately you will have to do this binding in code.
     
    Joe