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
1170
Set a Field's XamComboEditor ItemsProvider based on another Field's selected item
posted

I've got a XamDataGrid where one column (Column A) uses a XamComboEditor with a set number of choices, and an adjacent column (Column B) also using a XamComboEditor, should use a particular set of choices based on the selection in Column A.

I'm open to suggestions for how best to accomplish this, but I have this much so far:

I've created several styles as resources for the control with different ItemsProvider settings. 

Column A has a SelectedItemChanged event handler.

In the ColumnA_SelectedItemChanged method, I check the newly selected value, and I want to change the EditorStyle for the changed record's Column B to the one with the appropriate ItemsProvider. 

The problem I'm having with this approach is how to identify the changed record within the SelectedItemChanged event. The method footprint, which I got from another forum post, is ColumnA_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e). The event args just have the new and old values, and there doesn't seem to be a way to get a handle on the record from the XamComboEditor object.

So is there a way to modify this event handler, maybe with a different type for the event args, which would get me a handle on the Record? Or is there another way I should approach this problem?

Thanks.

Parents
No Data
Reply
  • 14517
    Verified Answer
    Offline posted

    Hello,

    A better way to implement this would to use a binding on the second combo (Column B) to the underlying value from Column A and then use a converter to limit the items in the drop down list. This would allow the user to select to view the drop down in Column B without having to select the corresponding item in Column A first.

    Please see attached sample.

    Let me know if you have any questions.

    Sincerely,

    Valerie

    Developer Support Supervisor - XAML

    Infragistics

    www.infragistics.com/support

     

    WpfApplication1.zip
Children