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
285
I'm not able top bind a simple Colletion to a ComboEditorField
posted

Hello All,

i'm not able to bind a simple ComboBox Dropdown to my Row view model.

Its working with WPF DataGrid but not with Infragsitics.

I want to show Operators in Class ValidationRuleViewModel in the ComboBox. After 2 hours i can't get it working with Infragistics. Its a real pain in the ass to work with Infragistic Controls, but we have to...

Can you provide me an Solution please?

Thanks again,

Chris

WpfApp3.zip
Parents
  • 34430
    Verified Answer
    Offline posted

    Hello Chris,

    It appears from the sample project you have provided, that you are running into the same issue for the WPF DataGrid as you are in the XamDataGrid in this case. On one of your WPF DataGrid columns (the one named "fghjghfj"), you are trying to directly bind to your "Operators" collection, and it is failing. The same goes for your "SelectedOperation" ComboBoxField in the XamDataGrid. These issues are from the same root cause, which is that DataGridComboBoxColumn and ComboBoxField are not UIElement derivations, and as such, they are not part of the visual tree of your application and cannot be directly bound in this way.

    It appears you had resolved this issue in the WPF DataGrid by using a CellTemplate. The resolution for the XamDataGrid is similar as the CellTemplate gets you to a visual element of your grid. I would recommend writing an EditorStyle for your ComboBoxField and setting your ItemsSource there. As you are using a ComboBoxField, this style should target the XamComboEditor in your "editors" namespace. The data context of this XamComboEditor is the underlying DataRecord that wraps it, which has a reference to the underlying data item it represents via its DataItem property. As it appears your "Operators" collection exists on your data item, you can bind to {Binding DataItem.Operators} in this XamComboEditor style to resolve this issue.

    I have attached a modified version of the sample project you have provided to demonstrate. I hope this helps.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    WpfApp3.zip
Reply Children
No Data