Skip to content

Commit

Permalink
docs: fixing linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal22shah authored and kazo0 committed Sep 19, 2024
1 parent fb06dad commit 0788754
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<CupertinoToolkitResources xmlns="using:Uno.Toolkit.UI.Cupertino" />

<!-- Load application resources -->
<ResourceDictionary Source="Converters.xaml" />
<ResourceDictionary Source="ms-appx:///Converters.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/Application/Colors.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/Application/Fonts.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/Button.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
<utu:NavigationBar.MainCommand>
<AppBarButton Label="Close"
Click="NavigateBack"
AutomationProperties.AutomationId="M3_NavBar_Close_Button"
Style="{StaticResource MaterialAppBarButtonStyle}">
AutomationProperties.AutomationId="M3_NavBar_Close_Button">
<AppBarButton.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/CloseIcon.png" />
</AppBarButton.Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,4 +583,4 @@
<Content Include="$(MSBuildThisFileDirectory)Assets\Media\SmallMedia.scale-400.png" />
<Content Include="$(MSBuildThisFileDirectory)Assets\UnoLogo.png" />
</ItemGroup>
</Project>
</Project>
134 changes: 71 additions & 63 deletions src/library/Uno.Toolkit.Material/Styles/Controls/v2/NavigationBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
xmlns:not_win="http://uno.ui/not_win"
xmlns:toolkit="using:Uno.UI.Toolkit"
xmlns:um="using:Uno.Material"
xmlns:ut="using:Uno.Themes"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="android ios not_win mobile">

<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">

<!-- NavigationBar default resources -->
<!-- NavigationBar default resources -->
<StaticResource x:Key="NavigationBarCommandBarEllipsisIconForegroundDisabled" ResourceKey="CommandBarEllipsisIconForegroundDisabled" />
<StaticResource x:Key="NavigationBarCommandBarBackgroundCompactOpenUp" ResourceKey="SurfaceBrush" />
<StaticResource x:Key="NavigationBarCommandBarBackgroundCompactOpenDown" ResourceKey="SurfaceBrush" />
Expand All @@ -37,12 +38,12 @@
<StaticResource x:Key="NavigationBarFontWeight" ResourceKey="TitleLargeFontWeight" />
<StaticResource x:Key="NavigationBarFontSize" ResourceKey="TitleLargeFontSize" />

<!-- MaterialModal Styles Resource -->
<!-- MaterialModal Styles Resource -->
<StaticResource x:Key="MaterialModalNavigationBarMainCommandForeground" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="MaterialModalNavigationBarForeground" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="MaterialModalNavigationBarBackground" ResourceKey="SurfaceBrush" />

<!-- PrimaryMaterial Styles Resource -->
<!-- PrimaryMaterial Styles Resource -->
<StaticResource x:Key="MaterialPrimaryNavigationBarCommandBarEllipsisIconForegroundDisabled" ResourceKey="CommandBarEllipsisIconForegroundDisabled" />
<StaticResource x:Key="MaterialPrimaryNavigationBarCommandBarBackgroundCompactOpenUp" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="MaterialPrimaryNavigationBarCommandBarBackgroundCompactOpenDown" ResourceKey="PrimaryBrush" />
Expand All @@ -56,15 +57,23 @@
<StaticResource x:Key="MaterialPrimaryModalNavigationBarForeground" ResourceKey="OnPrimaryBrush" />
<StaticResource x:Key="MaterialPrimaryModalNavigationBarBackground" ResourceKey="PrimaryBrush" />

<!-- Overflow AppBarButton Resources -->
<!-- Overflow AppBarButton Resources -->
<StaticResource x:Key="NavigationBarOverflowAppBarButtonForeground" ResourceKey="OnPrimaryBrush" />
<SolidColorBrush x:Key="NavigationBarOverflowAppBarButtonBackground"
Color="Transparent" />
<SolidColorBrush x:Key="NavigationBarOverflowAppBarButtonBackground" Color="Transparent" />

<!-- EllipsisButton Resources -->
<!-- EllipsisButton Resources -->
<StaticResource x:Key="NavigationBarEllipsisButtonForeground" ResourceKey="OnSurfaceBrush" />
<SolidColorBrush x:Key="NavigationBarEllipsisButtonBackground"
Color="Transparent" />
<SolidColorBrush x:Key="NavigationBarEllipsisButtonBackground" Color="Transparent" />

<not_mobile:StaticResource x:Key="AppBarButtonHeight"
ResourceKey="MaterialXamlNavigationBarHeight" />
<not_mobile:StaticResource x:Key="AppBarButtonWidth"
ResourceKey="MaterialXamlNavigationBarHeight" />

<mobile:StaticResource x:Key="AppBarButtonHeight"
ResourceKey="MaterialNavigationBarHeight" />
<mobile:StaticResource x:Key="AppBarButtonWidth"
ResourceKey="MaterialNavigationBarHeight" />

<x:Double x:Key="MaterialNavigationBarElevation">4</x:Double>
<x:Double x:Key="MaterialXamlNavigationBarHeight">64</x:Double>
Expand All @@ -77,7 +86,8 @@
<StaticResource x:Key="NavigationBarMaterialEllipsisButtonFontSize" ResourceKey="ControlContentThemeFontSize" />
<StaticResource x:Key="NavigationBarMaterialEllipsisButtonWidth" ResourceKey="AppBarExpandButtonThemeWidth" />

<x:Double x:Key="NavBarAppBarButtonContentHeight">24</x:Double>
<x:Double x:Key="NavBarAppBarButtonContentHeight">16</x:Double>
<StaticResource x:Key="AppBarButtonContentHeight" ResourceKey="NavBarAppBarButtonContentHeight" />
<x:Double x:Key="NavBarMainCommandAppBarButtonContentHeight">24</x:Double>
<x:Double x:Key="NavBarAppBarThemeCompactHeight">56</x:Double>
<Thickness x:Key="NavBarAppBarButtonPadding">12,16,12,16</Thickness>
Expand Down Expand Up @@ -116,12 +126,20 @@


<StaticResource x:Key="NavigationBarOverflowAppBarButtonForeground" ResourceKey="OnPrimaryBrush" />
<SolidColorBrush x:Key="NavigationBarOverflowAppBarButtonBackground"
Color="Transparent" />
<SolidColorBrush x:Key="NavigationBarOverflowAppBarButtonBackground" Color="Transparent" />

<StaticResource x:Key="NavigationBarEllipsisButtonForeground" ResourceKey="OnSurfaceBrush" />
<SolidColorBrush x:Key="NavigationBarEllipsisButtonBackground"
Color="Transparent" />
<SolidColorBrush x:Key="NavigationBarEllipsisButtonBackground" Color="Transparent" />

<not_mobile:StaticResource x:Key="AppBarButtonHeight"
ResourceKey="MaterialXamlNavigationBarHeight" />
<not_mobile:StaticResource x:Key="AppBarButtonWidth"
ResourceKey="MaterialXamlNavigationBarHeight" />

<mobile:StaticResource x:Key="AppBarButtonHeight"
ResourceKey="MaterialNavigationBarHeight" />
<mobile:StaticResource x:Key="AppBarButtonWidth"
ResourceKey="MaterialNavigationBarHeight" />

<x:Double x:Key="MaterialNavigationBarElevation">4</x:Double>
<x:Double x:Key="MaterialXamlNavigationBarHeight">64</x:Double>
Expand All @@ -134,7 +152,8 @@
<StaticResource x:Key="NavigationBarMaterialEllipsisButtonFontSize" ResourceKey="ControlContentThemeFontSize" />
<StaticResource x:Key="NavigationBarMaterialEllipsisButtonWidth" ResourceKey="AppBarExpandButtonThemeWidth" />

<x:Double x:Key="NavBarAppBarButtonContentHeight">24</x:Double>
<x:Double x:Key="NavBarAppBarButtonContentHeight">16</x:Double>
<StaticResource x:Key="AppBarButtonContentHeight" ResourceKey="NavBarAppBarButtonContentHeight" />
<x:Double x:Key="NavBarMainCommandAppBarButtonContentHeight">24</x:Double>
<x:Double x:Key="NavBarAppBarThemeCompactHeight">56</x:Double>
<Thickness x:Key="NavBarAppBarButtonPadding">12,16,12,16</Thickness>
Expand All @@ -145,7 +164,7 @@

<Style x:Key="BaseMaterialNavigationBarStyle"
TargetType="utu:NavigationBar">
<!-- Setting content to empty to avoid getting the datacontext -->
<!-- Setting content to empty to avoid getting the datacontext -->
<Setter Property="Content" Value="" />
<Setter Property="ContentTemplate">
<Setter.Value>
Expand Down Expand Up @@ -178,18 +197,8 @@

<!--#region Default Material NavigationBar-->
<Style x:Key="MaterialMainCommandStyle"
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="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Width" Value="68" />
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="FocusVisualMargin" Value="-3" />
<Setter Property="AllowFocusOnInteraction" Value="False" />
TargetType="AppBarButton"
BasedOn="{StaticResource MaterialAppBarButtonStyle}">
<Setter Property="Content" Value="{ThemeResource NavigationBarBackIconData}" />
<Setter Property="Template">
<Setter.Value>
Expand All @@ -203,20 +212,23 @@
<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}" />
Expand All @@ -235,19 +247,22 @@
Control.IsTemplateFocusTarget="True" />

<Grid x:Name="ContentRoot"
MinHeight="{ThemeResource AppBarThemeMinHeight}">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>

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 NavBarMainCommandAppBarButtonContentHeight}"
MaxWidth="{ThemeResource NavBarMainCommandAppBarButtonContentHeight}"
Visibility="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NullToCollapsedConverter}}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
AutomationProperties.AccessibilityView="Raw">
<ContentPresenter x:Name="Content"
Content="{TemplateBinding Icon}"
Foreground="{TemplateBinding Foreground}" />
</Viewbox>
<PathIcon Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"
Visibility="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NullToVisibleConverter}}"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
Expand Down Expand Up @@ -319,15 +334,15 @@
Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<StaticResource x:Key="AppBarButtonContentHeight" ResourceKey="NavBarAppBarButtonContentHeight" />
<!--<StaticResource x:Key="AppBarButtonContentHeight" ResourceKey="NavBarAppBarButtonContentHeight" />-->
<StaticResource x:Key="AppBarThemeCompactHeight" ResourceKey="NavBarAppBarThemeCompactHeight" />
<Style BasedOn="{StaticResource SplitButtonCommandBarStyle}"
TargetType="SplitButton" />
<Style BasedOn="{StaticResource SplitButtonCommandBarStyle}"
TargetType="ToggleSplitButton" />
<Style BasedOn="{StaticResource MaterialAppBarButtonStyle}"
TargetType="AppBarButton">
<Setter Property="Padding" Value="{ThemeResource NavBarAppBarButtonPadding}" />
<!--<Setter Property="Padding" Value="{ThemeResource NavBarAppBarButtonPadding}" />-->
</Style>
</Grid.Resources>
<Grid x:Name="ContentRoot"
Expand Down Expand Up @@ -355,11 +370,7 @@
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="MainCommandPresenter"
Margin="{TemplateBinding Padding}"
Content="{Binding Path=(utu:CommandBarExtensions.MainCommand), RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter.Resources>
<StaticResource x:Key="AppBarButtonContentHeight" ResourceKey="NavBarMainCommandAppBarButtonContentHeight" />
</ContentPresenter.Resources>
</ContentPresenter>
Content="{Binding Path=(utu:CommandBarExtensions.MainCommand), RelativeSource={RelativeSource TemplatedParent}}" />

<!--
Use a ContentControl rather than a ContentPresenter so that IsEnabled can be set to false
Expand Down Expand Up @@ -397,7 +408,7 @@
Grid.Column="2"
MinHeight="{ThemeResource AppBarThemeCompactHeight}"
Padding="{ThemeResource CommandBarMoreButtonMargin}"
VerticalAlignment="Top"
VerticalAlignment="Center"
Control.IsTemplateKeyTipTarget="True"
Foreground="{TemplateBinding Foreground}"
IsAccessKeyScope="True"
Expand All @@ -414,7 +425,7 @@
</FontIcon.RenderTransform>
</FontIcon>
</Button>
<!-- UNO WORKAROUND: Added IsHitTestVisible="False". The Rectangle was blocking pointer events -->
<!-- UNO WORKAROUND: Added IsHitTestVisible="False". The Rectangle was blocking pointer events -->
<Rectangle x:Name="HighContrastBorder"
Grid.ColumnSpan="3"
VerticalAlignment="Stretch"
Expand All @@ -429,7 +440,7 @@
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
Visibility="Collapsed" />
</Grid>
<!-- UNO WORKAROUND: Added IsTabStop="False". Navigation focus with keyboard was erroneously focusing on the Popup instead of the SecondaryCommands -->
<!-- UNO WORKAROUND: Added IsTabStop="False". Navigation focus with keyboard was erroneously focusing on the Popup instead of the SecondaryCommands -->
<Popup x:Name="OverflowPopup">
<Popup.RenderTransform>
<TransformGroup>
Expand All @@ -446,7 +457,7 @@
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- For 21H1 and up, we'll need to wrap the clip and presenter in a Grid which will host the Drop Shadow. -->
<!-- For 21H1 and up, we'll need to wrap the clip and presenter in a Grid which will host the Drop Shadow. -->
<Grid x:Name="SecondaryItemsControlShadowWrapper"
contract7NotPresent:CornerRadius="{ThemeResource OverlayCornerRadius}"
contract7Present:CornerRadius="{ThemeResource OverlayCornerRadius}">
Expand Down Expand Up @@ -499,7 +510,7 @@
</VisualStateGroup>
<VisualStateGroup x:Name="DisplayModeStates">
<contract8Present:VisualStateGroup.Transitions>
<!-- UNO WORKAROUND: Use literal value of ControlNormalAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<!-- UNO WORKAROUND: Use literal value of ControlNormalAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<VisualTransition GeneratedDuration="00:00:00.250"
From="CompactClosed"
To="CompactOpenDown">
Expand Down Expand Up @@ -547,7 +558,7 @@
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
<!-- UNO WORKAROUND: Use literal value of ControlFastAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<!-- UNO WORKAROUND: Use literal value of ControlFastAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<VisualTransition GeneratedDuration="00:00:00.167"
From="CompactOpenDown"
To="CompactClosed">
Expand Down Expand Up @@ -827,11 +838,8 @@
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="MainCommandPresenter"
Margin="{TemplateBinding Padding}"
Content="{Binding Path=(utu:CommandBarExtensions.MainCommand), RelativeSource={RelativeSource TemplatedParent}}">
<ContentPresenter.Resources>
<StaticResource x:Key="AppBarButtonContentHeight" ResourceKey="NavBarMainCommandAppBarButtonContentHeight" />
</ContentPresenter.Resources>
</ContentPresenter>
Content="{Binding Path=(utu:CommandBarExtensions.MainCommand), RelativeSource={RelativeSource TemplatedParent}}" />


<!--
Use a ContentControl rather than a ContentPresenter so that IsEnabled can be set to false
Expand Down Expand Up @@ -886,7 +894,7 @@
</FontIcon.RenderTransform>
</FontIcon>
</Button>
<!-- UNO WORKAROUND: Added IsHitTestVisible="False". The Rectangle was blocking pointer events -->
<!-- UNO WORKAROUND: Added IsHitTestVisible="False". The Rectangle was blocking pointer events -->
<Rectangle x:Name="HighContrastBorder"
Grid.ColumnSpan="3"
VerticalAlignment="Stretch"
Expand All @@ -901,7 +909,7 @@
contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
Visibility="Collapsed" />
</Grid>
<!-- UNO WORKAROUND: Added IsTabStop="False". Navigation focus with keyboard was erroneously focusing on the Popup instead of the SecondaryCommands -->
<!-- UNO WORKAROUND: Added IsTabStop="False". Navigation focus with keyboard was erroneously focusing on the Popup instead of the SecondaryCommands -->
<Popup x:Name="OverflowPopup">
<Popup.RenderTransform>
<TransformGroup>
Expand All @@ -918,7 +926,7 @@
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- For 21H1 and up, we'll need to wrap the clip and presenter in a Grid which will host the Drop Shadow. -->
<!-- For 21H1 and up, we'll need to wrap the clip and presenter in a Grid which will host the Drop Shadow. -->
<Grid x:Name="SecondaryItemsControlShadowWrapper"
contract7NotPresent:CornerRadius="{ThemeResource OverlayCornerRadius}"
contract7Present:CornerRadius="{ThemeResource OverlayCornerRadius}">
Expand Down Expand Up @@ -971,7 +979,7 @@
</VisualStateGroup>
<VisualStateGroup x:Name="DisplayModeStates">
<contract8Present:VisualStateGroup.Transitions>
<!-- UNO WORKAROUND: Use literal value of ControlNormalAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<!-- UNO WORKAROUND: Use literal value of ControlNormalAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<VisualTransition GeneratedDuration="00:00:00.250"
From="CompactClosed"
To="CompactOpenDown">
Expand Down Expand Up @@ -1019,7 +1027,7 @@
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
<!-- UNO WORKAROUND: Use literal value of ControlFastAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<!-- UNO WORKAROUND: Use literal value of ControlFastAnimationDuration. Resolving a StaticResource string to a string non-DP causes an exception -->
<VisualTransition GeneratedDuration="00:00:00.167"
From="CompactOpenDown"
To="CompactClosed">
Expand Down

0 comments on commit 0788754

Please sign in to comment.