-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: material appbarbutton styles + converter bug (#1473)
(cherry picked from commit 1724854)
- Loading branch information
1 parent
5d7a54a
commit d307cf3
Showing
3 changed files
with
100 additions
and
100 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
src/library/Uno.Material/Styles/Controls/v2/AppBarButton.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:um="using:Uno.Material" | ||
xmlns:toolkit="using:Uno.UI.Toolkit" | ||
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:android="http://uno.ui/android" | ||
xmlns:ios="http://uno.ui/ios" | ||
xmlns:uuc="using:Uno.UI.Controls" | ||
mc:Ignorable="android ios"> | ||
<Style x:Key="MaterialAppBarButtonStyle" | ||
TargetType="AppBarButton"> | ||
<Setter Property="Background" Value="{ThemeResource AppBarButtonBackground}" /> | ||
<Setter Property="Foreground" Value="{ThemeResource AppBarButtonForeground}" /> | ||
<Setter Property="BorderBrush" Value="{ThemeResource AppBarButtonBorderBrush}" /> | ||
<Setter Property="HorizontalAlignment" Value="Left" /> | ||
<Setter Property="VerticalAlignment" Value="Top" /> | ||
<Setter Property="Height" Value="{ThemeResource AppBarButtonHeight}" /> | ||
<Setter Property="Width" Value="{ThemeResource AppBarButtonWidth}" /> | ||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" /> | ||
<Setter Property="FocusVisualMargin" Value="-3" /> | ||
<Setter Property="AllowFocusOnInteraction" Value="False" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="AppBarButton"> | ||
<um:Ripple Feedback="{TemplateBinding Foreground}" | ||
FeedbackOpacity="{StaticResource PressedOpacity}" | ||
MinWidth="{TemplateBinding MinWidth}" | ||
MaxWidth="{TemplateBinding MaxWidth}"> | ||
<Grid x:Name="Root" | ||
Background="Transparent"> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup x:Name="CommonStates"> | ||
<VisualState x:Name="Normal" /> | ||
|
||
<VisualState x:Name="PointerOver"> | ||
<VisualState.Setters> | ||
<Setter Target="AppBarButtonInnerBorder.Background" Value="{ThemeResource AppBarButtonBackgroundPointerOver}" /> | ||
<Setter Target="AppBarButtonInnerBorder.BorderBrush" Value="{ThemeResource AppBarButtonBorderBrushPointerOver}" /> | ||
<Setter Target="Content.Foreground" Value="{ThemeResource AppBarButtonForegroundPointerOver}" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
|
||
<VisualState x:Name="Pressed"> | ||
<VisualState.Setters> | ||
<Setter Target="AppBarButtonInnerBorder.Background" Value="{ThemeResource AppBarButtonBackgroundPressed}" /> | ||
<Setter Target="AppBarButtonInnerBorder.BorderBrush" Value="{ThemeResource AppBarButtonBorderBrushPressed}" /> | ||
<Setter Target="Content.Foreground" Value="{ThemeResource AppBarButtonForegroundPressed}" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
|
||
<VisualState x:Name="Disabled"> | ||
<VisualState.Setters> | ||
<Setter Target="AppBarButtonInnerBorder.Background" Value="{ThemeResource AppBarButtonBackgroundDisabled}" /> | ||
<Setter Target="AppBarButtonInnerBorder.BorderBrush" Value="{ThemeResource AppBarButtonBorderBrushDisabled}" /> | ||
<Setter Target="Content.Foreground" Value="{ThemeResource AppBarButtonForegroundDisabled}" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
|
||
<Border x:Name="AppBarButtonInnerBorder" | ||
Margin="{ThemeResource AppBarButtonInnerBorderMargin}" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
Control.IsTemplateFocusTarget="True" /> | ||
|
||
<Grid x:Name="ContentRoot" | ||
VerticalAlignment="Center" | ||
HorizontalAlignment="Center"> | ||
<!-- UNO WORKAROUND: The ViewBox center should be horizontal Stretch but the Grid aligns the content left --> | ||
<Viewbox x:Name="ContentViewbox" | ||
MaxHeight="{ThemeResource AppBarButtonContentHeight}" | ||
MaxWidth="{ThemeResource AppBarButtonContentHeight}" | ||
VerticalAlignment="Center" | ||
HorizontalAlignment="Center" | ||
AutomationProperties.AccessibilityView="Raw"> | ||
<ContentPresenter x:Name="Content" | ||
Content="{TemplateBinding Icon}" | ||
Foreground="{TemplateBinding Foreground}" /> | ||
</Viewbox> | ||
</Grid> | ||
</Grid> | ||
</um:Ripple> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style x:Key="MaterialDefaultAppBarButtonStyle" | ||
TargetType="AppBarButton" | ||
BasedOn="{StaticResource MaterialAppBarButtonStyle}" /> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters