I am building a form and am using XamComboEditors for many of my form elements. I additionally have a more complex form item where I need to have some kind of dropdown that, when opened, displays a user control that is editable on its own.
Currently, I am using a ToggleButton and a Popup, in which the Popup hosts the UserControl, and the ToggleButton toggles the IsOpen property of the Popup.
So my xaml looks something like this:
<ToggleButton x:Name="toggleButton"> My Toggle Button </ToggleButton> <Popup IsOpen="{Binding IsChecked, Mode=TwoWay, ElementName=toggleButton}" StaysOpen="False" PlacementTarget="{Binding ElementName=toggleButton}" Placement="Bottom" PopupAnimation="Slide"> <MyCustomControl /> </Popup>
However, I would really like this custom dropdown to match the style of the other XamComboEditors that I am using in my form. Initially, I started looking into trying to replicate the built-in styles for the XamComboEditor to build my toggle button to look identical, but that would be VERY tedious and difficult to maintain.
But it is also to my understanding that many WPF combo boxes are actually implemented similarly to how my custom dropdown works, in which a toggle button toggles a popup that is attached to the button. This got me thinking that it might make more sense to try to configure the Infragistics XamComboEditor to work as a content presenter, rather than as a control for selecting an item from a dropdown list.
Is there any way for me to do this? Essentially, I want to configure the XamComboEditor to simply display an interactive custom control (e.g., a XamDataTree) in its dropdown, and ignore any kind of item selection.
Yep, this worked! Thanks!
Hello Andrew,
Yes this is certainly possible by re-templating the default style of the XamComboEditor.
You can find the default style at this path and find the popup and replace with your own control like XamDataTree.
C:\Program Files (x86)\Infragistics\2020.2\WPF\DefaultStyles\XamComboEditor\generic.xaml
Here I attached a sample showing that .you can see I added the XamDataTree at line no 571.
Let me know if you have any question.
8233.Sample.zip