diff --git a/src/Avalonia.Controls/DropDownItem.cs b/src/Avalonia.Controls/DropDownItem.cs index 3fd80c4562..fb465e93ec 100644 --- a/src/Avalonia.Controls/DropDownItem.cs +++ b/src/Avalonia.Controls/DropDownItem.cs @@ -22,14 +22,13 @@ namespace Avalonia.Controls static DropDownItem() { FocusableProperty.OverrideDefaultValue(true); - IsFocusedProperty.Changed.Subscribe(x => - { - var sender = x.Sender as IControl; + } - if (sender != null) - { - ((IPseudoClasses)sender.Classes).Set(":selected", (bool)x.NewValue); - } + public DropDownItem() + { + this.GetObservable(DropDownItem.IsFocusedProperty).Subscribe(focused => + { + PseudoClasses.Set(":selected", focused); }); }