I have this very simple Combobox in my XAML:
<ComboBox Name="cmb1" Width="200" Height="23" ItemsSource="{Binding}" />
and this is my code behind:
public class Test //: System.Windows.DependencyObject
{
public string Name { get; set; }
public override string ToString() { return Name; }
}
public MainWindow()
{
InitializeComponent();
var col = new ObservableCollection<Test>();
cmb1.DataContext = col;
col.Add(new Test { Name = "A" });
col.Add(new Test { Name = "B" });
col.Add(new Test { Name = "C" });
col.Add(new Test { Name = "D" });
}
As long as Test class is NOT inherited from DependencyObject everything is fine. But when it is inherited, ComboBox does not show current item when it is not expanded.
Current Item is selected when I click on ComboBox and see its drop-box.