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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
7 deletions
-
src/Avalonia.Controls/DropDownItem.cs
|
|
|
@ -22,14 +22,13 @@ namespace Avalonia.Controls |
|
|
|
static DropDownItem() |
|
|
|
{ |
|
|
|
FocusableProperty.OverrideDefaultValue<DropDownItem>(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); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|