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
155
Binding Visibility of a Field to a Property on the User Control
posted

I'm trying to bind the Visibility of a Field to a property on the User Control in th XamDataGrid. I am aware that you cannot use standard WPF binding because it is not part of the element/visual tree of the application. I tried to use Josh Smith's article to solve this problem but I am unable to apply this solution using a User Control. The example uses a Window. Can someone help me out?

 Thanks in advance..

 

Parents
No Data
Reply
  • 9694
    posted

    Hi there,

    Look in the WPF NetAdvantage Feature Browser sample at the XamDataGrid, Control Composition, Adorning Editors example. This shows how to use a DataTrigger binding within a CellValuePresenter. You could use this example to bind a data property to the Visibility of the cell (field). You may need to create a property in your data (a view model property for example) that is bound to both the UserControl property and to the cell property - this depends on where the UserControl lives.

    If this suggestion does not simplify what you need to do, refactor your issue into a small sample project with a similar UserControl and the grid code and the area you want to modify visibility. Post the project in a zip archive and I will update it to make it work and re-post it here.

Children