Hi,
Currently I've been using XamComboEditor and XamMultiColumnComboEditor successfully, and they have both worked just great.
I'd like to create a new control that is also a combo, but this time to allow you to select from a hierarchical tree view.
How should I do that? Is it possible to inherit from Infragistics.Controls.Editors.ComboEditorBase with my own control?
Would you be able to provide a sample for that?
Thanks!
Hi Rennen,
We don't currently have a sample that implements a tree control in the combo dropdown but I think it should be possible. You can see how we define the Popup used in the dropdown in the DefaultStyles folder: C:\Program Files (x86)\Infragistics\2015.2\WPF\DefaultStyles\XamComboEditor\generic.xaml
The Popup contains an ItemsPanel which is used to render the items in the ItemsSource but I imagine that you could replace this panel with a TreeView control and just bind it to the XamComboEditor's ItemsSource. This should get you a populated tree but you will have to handle selection yourself. The XamComboEditor has a SelectedItem property which you might be able to directly bind to the TreeView's own SelectedItem so that might actually be all you need. It really depends on what your requirements are.
The beauty of XAML, though, is that you can replace a lot of things as long as you know what the original XAML looks like and we provide all of that with our product. In some cases if we name a component with "PART_" then it's likely we try and access that in internally so removing it would be bad. I'm pretty sure removing the ItemsPanel from the XamComboEditor dropdown would be bad so you'll have to hide it instead.
Let me know if you run into an questions/issues while trying to implement this and I'll try to help.
I gave it a try but this is too complex for me to get all the bindings correctly. Would it be possible for you to put a quick sample together please?
I'm sure it will be beneficial for others as well.
Thanks,
Rennen
I put together a sample that might help you get started. I created a new class deriving from XamComboEditor and I modified the default style to add our XamDataTree control. I hooked up the ItemsSource and selection properties and exposed some selection properties on the new combo editor that you can bind to. There is a SelectedTreeItem property for single selection and a SelectedTreeItems for multiple selection. There is also a NodeSelection property which lets you switch between single and multiple selection.
This seems to work but with quite a few UI issues with the scrollers and dropdown toggle button. I'll try to play with the styles.