❔ WPF derived combo box doesn't show up in namespace
I created a class derived from
System.Windows.Controls.ComboBox
. I then rebuilt the DLL containing the combo box. Other controls show up in the list of controls ready to drop into my window. But not the combo box. Is there something that prevents controls not derived from System.Windows.Controls.UserControl
from showing up? My class doesn't have a XAML file. Could that be it?16 Replies
no idea, the designer is generally best to be avoided completely
Well, it looks like if I manually typed in the class, I'd get a compile time error.
typed it in how?
In the XAML source, you can manually enter the tag you want. So you could manually enter
<ComboBox/>
.right
and what did you type?
i recommend that your read more about System.Windows.Controls.ComboBox and its examples and usage.
https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.combobox?view=windowsdesktop-7.0
ComboBox Class (System.Windows.Controls)
Represents a selection control with a drop-down list that can be shown or hidden by clicking the arrow on the control.
What error?
Could you show the
EnumComboBox
class please?It's called
EnumComboBoxCtrl
and you're trying to use EnumComboBox
Also, I'm not sure if you can use generic classes in xaml:p
May I ask what the purpose of this control is?
Well, I want to associate the values in an enum with translatable text. I can't be assured of the order due to sorting.
So the class will take the enum, look up a value from an attribute and put that into the combobox as the display string.
You can this approach:
https://stackoverflow.com/a/47064218
Stack Overflow
WPF How to bind an enum with Description to a ComboBox
How can I bind an enum with Description (DescriptionAttribute) to a ComboBox?
I got an enum:
public enum ReportTemplate
{
[Description("Top view")]
TopView,
[Description("Section vie...
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.