Browse Source

Merge pull request #1648 from AvaloniaUI/fix/selected-psuedo-class-getting-cleared

fix bug introduced in dropdownitem the clears :selected psuedo class
pull/1657/head
danwalmsley 8 years ago
committed by GitHub
parent
commit
862c291b07
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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