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
130
Hosting UserControl in XamComboEditor dropdown
posted

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.