Browse Source

fix bug introduced in dropdownitem the clears :selected psuedo class

from any control that has IsFocusedProperty.
pull/1648/head
Dan Walmsley 8 years ago
parent
commit
15bb5cf88f
  1. 13
      src/Avalonia.Controls/DropDownItem.cs

13
src/Avalonia.Controls/DropDownItem.cs

@ -22,14 +22,13 @@ namespace Avalonia.Controls
static DropDownItem() static DropDownItem()
{ {
FocusableProperty.OverrideDefaultValue<DropDownItem>(true); FocusableProperty.OverrideDefaultValue<DropDownItem>(true);
IsFocusedProperty.Changed.Subscribe(x => }
{
var sender = x.Sender as IControl;
if (sender != null) public DropDownItem()
{ {
((IPseudoClasses)sender.Classes).Set(":selected", (bool)x.NewValue); this.GetObservable(DropDownItem.IsFocusedProperty).Subscribe(focused =>
} {
PseudoClasses.Set(":selected", focused);
}); });
} }

Loading…
Cancel
Save