-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
Description
Describe the bug
Here is a combobox
<ComboBox ItemsSource="{CompiledBinding ClassList}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="controlDemo:MyControl">
<TextBlock Text="{CompiledBinding MyName}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>public class ViewModel:ReactiveUI.ReactiveObject
{
public AvaloniaList<MyControl> ClassList { get; } = new(){new MyControl(){MyName = "MyName One"},new MyControl(){MyName = "MyName Two"} };
}
public class MyControl:Control
{
public string MyName
{
get;
init;
}
}
The combobox shows the ClassList. The MyControl s are shown correctly in popup, however, the selected one in SelectionBox turns out to be "Avalonia.Controls.Shape.Rectangle", although there's no "Avalonia.Controls.Shape.Rectangle" in all the code.
This issue may happen only when the model to be shown is a child class of Control.
To Reproduce
As i have written in Describe the Bug
Expected behavior
Show the content according to the DataTemplate, not "Avalonia.Controls.Shape.Rectangle"
Avalonia version
The latest version(11.3.11)
OS
Windows
Additional context
No response