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
1425
Combobox in XamDataGrid Header, binding ItemsSource
posted

Using WPF  XamDataGrid 12.1, .NET 4.5, I have a XamDataGrid that contains engineering values. In the header of each column, I have a XamComboBox where the user can select the units to display the value in, ie: feet, meters, or psi,Pa, Mpa, etc.

I've styled the LabelPresenter to contain the XamComboBox, and all works well IF I add the combo box items manually via the XamComboBoxItemsProvider XAML construct, but I cannot get the XamComboBox to bind to an ObservableCollection via the ItemsSource property.

What am I doing wrong? Any examples?

Parents
  • 22015
    posted

    Hello Michael,

     Thank you for your post. I have been looking into it and have created a small sample for you, named ComboInLabelPresenter. In the sample I set a style for the LabelPresenter and set the xamComboEditor as template for the presenter. Then I bind the combo to the ObservableCollection, that is source for the grid. I have a different style for each field, since the label is different for every column. If you want to display same values for the labels you can move the style to the resources of the window. Please find the attached sample and feel free to let me know if you have any further questions on the mater.

    ComboInLabelPresenter.zip
Reply Children
No Data