Skip to content

Commit

Permalink
Visual state change for disabled RadioButton
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed Jul 7, 2024
1 parent 9b44c9a commit 53d03ea
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Controls/src/Core/RadioButton/RadioButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -588,12 +588,21 @@ static View BuildDefaultTemplate()
nameScope.RegisterName(UncheckedButton, normalEllipse);
nameScope.RegisterName(CheckedIndicator, checkMark);
nameScope.RegisterName("ContentPresenter", contentPresenter);
nameScope.RegisterName("Grid", grid);

VisualStateGroupList visualStateGroups = new VisualStateGroupList();

var common = new VisualStateGroup() { Name = "Common" };
common.States.Add(new VisualState() { Name = VisualStateManager.CommonStates.Normal });
common.States.Add(new VisualState() { Name = VisualStateManager.CommonStates.Disabled });
VisualState disabledVisualState = new VisualState() { Name = VisualStateManager.CommonStates.Disabled };
disabledVisualState.Setters.Add(
new Setter()
{
Property = Grid.OpacityProperty,
TargetName = "Grid",
Value = 0.4f
});
common.States.Add(disabledVisualState);

visualStateGroups.Add(common);

Expand Down

0 comments on commit 53d03ea

Please sign in to comment.