ui: Highlight launcher buttons when selected
Namely, the expandable menu buttons in Analytics shell module
This commit is contained in:
1 parent
adc9f2acfc
commit
9172e752e3
3 files changed
+31
-4
No files matched your search
@@ -755,6 +755,8 @@ namespace mbts.ui {
|
||||
public static BTSColor pressed_border => 0xff707070;
|
||||
public static BTSColor pressed_foreground => normal_foreground;
|
||||
|
||||
// Selected
|
||||
public static BTSColor selected_background => input_selected_background;
|
||||
|
||||
// Disabled
|
||||
public static BTSColor disabled_background => normal_background;
|
||||
|
||||
@@ -23,6 +23,14 @@ namespace mbts.ui.converters {
|
||||
};
|
||||
}
|
||||
|
||||
public static IValueConverter CheckedStateNameConverter { get; } =
|
||||
ValueConverter.create<bool?, string>(isChecked =>
|
||||
isChecked switch {
|
||||
true => "Checked",
|
||||
false => "Unchecked",
|
||||
_ => "Indeterminate",
|
||||
});
|
||||
|
||||
public static readonly IMultiValueConverter
|
||||
AreEqualConverter = new AreEqualConverter();
|
||||
|
||||
|
||||
@@ -51,6 +51,13 @@
|
||||
<StaticResource ResourceKey="Button.Pressed.BackgroundTimeline"/>
|
||||
<StaticResource ResourceKey="Button.Pressed.BorderTimeline"/>
|
||||
</Storyboard>
|
||||
<!--ToggleButton Checked-->
|
||||
<ObjectAnimationUsingKeyFrames x:Key="ToggleButton.Checked.BackgroundTimeline" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{u:BTSColor UI.Button.selected_background}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<Storyboard x:Key="ToggleButton.Checked.Storyboard">
|
||||
<StaticResource ResourceKey="ToggleButton.Checked.BackgroundTimeline"/>
|
||||
</Storyboard>
|
||||
|
||||
<!--ListBox MouseOver-->
|
||||
<ObjectAnimationUsingKeyFrames x:Key="ListBoxItem.MouseOver.BackgroundTimeline" Storyboard.TargetProperty="(Control.Background)">
|
||||
@@ -718,15 +725,25 @@
|
||||
<u:StateManager.Groups>
|
||||
<u:StateGroupsManager AttachToMembers="True">
|
||||
<u:StateDefinitionCollection>
|
||||
<u:MouseStateDefinition MouseSource="{Binding Group.Target.TemplatedParent, RelativeSource={RelativeSource Self}}"/>
|
||||
<u:MouseStateDefinition
|
||||
Mode="{Binding
|
||||
Group.Target.TemplatedParent.IsChecked,
|
||||
RelativeSource={RelativeSource Self},
|
||||
Converter={x:Static cv:ValueConverters.CheckedStateNameConverter}}"
|
||||
MouseSource="{Binding Group.Target.TemplatedParent, RelativeSource={RelativeSource Self}}" />
|
||||
</u:StateDefinitionCollection>
|
||||
</u:StateGroupsManager>
|
||||
</u:StateManager.Groups>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup Name="MouseStates">
|
||||
<VisualState Name="Normal"/>
|
||||
<VisualState Name="MouseOver" Storyboard="{StaticResource Button.MouseOver.Storyboard}"/>
|
||||
<VisualState Name="Pressed" Storyboard="{StaticResource Button.Pressed.Storyboard}"/>
|
||||
<VisualState Name="UncheckedNormal"/>
|
||||
<VisualState Name="CheckedNormal" Storyboard="{StaticResource ToggleButton.Checked.Storyboard}" />
|
||||
|
||||
<VisualState Name="UncheckedMouseOver" Storyboard="{StaticResource Button.MouseOver.Storyboard}"/>
|
||||
<VisualState Name="CheckedMouseOver" Storyboard="{StaticResource Button.MouseOver.Storyboard}"/>
|
||||
|
||||
<VisualState Name="UncheckedPressed" Storyboard="{StaticResource Button.Pressed.Storyboard}"/>
|
||||
<VisualState Name="CheckedPressed" Storyboard="{StaticResource Button.Pressed.Storyboard}"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ContentPresenter
|
||||
|
||||
Reference in new issue
Block a user