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
490
How can I reference the grid's DataContext when using a MultiValueConverter and an Unboundfield?
posted

Hello,

I am using WPF NetAdvantage 2012.2 (and cannot update to a later version).

I have a xamdatagrid with an UnboundField defined.  I need to apply a binding converter to this unbound field and need to pass in the DataItem itself (which seems straighforward) and the DataContext of the grid.

Can I have an example of how to do this?  The trouble I am having is with getting access to the DataContext from the Unboundfield.

Thanks.

Parents
No Data
Reply
  • 17475
    Offline posted

    Hello Torque, 

    The UnboundField does not derive from FrameworkElement and its DataContext is not initially set. You can try using the following binding for the UnboundField if you would like to get the XamDataGrid’s DataContext

    Binding="{Binding Path=Cell.DataPresenter.DataContext, RelativeSource={RelativeSource Self}}"

    If you have any questions or concerns on the same do not hesitate to let me know.

Children