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
1150
Binding to id field while displaying text field without using workarounds
posted

Hello,

how can I bind to id fields while showing assocciated display text fields in the grid?

I managed the grid view and editing by styles, but unfortunately this seems like a hack.
While the grid displays what I want, as soon as I enable features like filtering or grouping, the underlying id data is displayed again. 

I thought about completely remove id binding and bind direct to the display text columns.
But this raises other issues. Only think about two different records with the same display text.
The reverse mapping to the actual database record would be impossible.

So, is there any built-in support to do this without using workarounds?

Thanks. 

Parents
  • 30945
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into your question and if I understand correctly, you wish to bind some of the properties of the fields that you have defined in xaml, to your view model directly.

     

    Since the fields are not part of the visual tree and also do not have a DataContext property, if you wish to create a binding to some of properties of the Field class, the Binding’s Source should be set.

     

    If you would like to avoid setting the Source and bind to the DataContext of the XamDataGrid, I can suggest creating an attached property for the Field that is creating the binding. I have created a sample application you, that shows how you can implement this approach.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir, MCPD

    Developer Support Supervisor - XAML

    Infragistics

    www.infragistics.com/support

     

    FieldProxyBinding.zip
Reply Children