Skip to content

Commit

Permalink
chore: xaml styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal22shah committed Jun 18, 2024
1 parent 14cceb2 commit 1be0ab1
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 61 deletions.
83 changes: 40 additions & 43 deletions src/library/Uno.Material/Styles/Controls/v2/CommandBar.xaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:android="http://uno.ui/android"
xmlns:ios="http://uno.ui/ios"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="using:Uno.UI.Toolkit"
xmlns:um="using:Uno.Material"
xmlns:uuc="using:Uno.UI.Controls"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="android ios">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:android="http://uno.ui/android"
xmlns:ios="http://uno.ui/ios"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="using:Uno.UI.Toolkit"
xmlns:um="using:Uno.Material"
xmlns:uuc="using:Uno.UI.Controls"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
mc:Ignorable="android ios">

<!-- Define Material properties for CommandBar -->
<!-- Define Material properties for CommandBar -->
<x:Double x:Key="MaterialCommandBarElevation">4</x:Double>
<x:Double x:Key="MaterialCommandBarHeight">48</x:Double>

<!-- Define Material AppBarButton Style -->
<Style x:Key="MaterialAppBarButtonStyle" TargetType="AppBarButton">
<!-- Define Material AppBarButton Style -->
<Style x:Key="MaterialAppBarButtonStyle"
TargetType="AppBarButton">
<Setter Property="Height" Value="{StaticResource MaterialCommandBarHeight}" />
<Setter Property="Width" Value="{StaticResource MaterialCommandBarHeight}" />
<Setter Property="Background" Value="Transparent" />
Expand All @@ -26,46 +26,43 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="AppBarButton">
<um:Ripple Feedback="{TemplateBinding Foreground}" FeedbackOpacity="{StaticResource PressedOpacity}">
<Viewbox
x:Name="ContentViewbox"
MaxWidth="{ThemeResource AppBarButtonContentHeight}"
MaxHeight="{ThemeResource AppBarButtonContentHeight}"
Margin="0,12"
HorizontalAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"
StretchDirection="DownOnly">
<ContentPresenter
x:Name="Content"
Content="{TemplateBinding Icon}"
Foreground="{TemplateBinding Foreground}" />
<um:Ripple Feedback="{TemplateBinding Foreground}"
FeedbackOpacity="{StaticResource PressedOpacity}">
<Viewbox x:Name="ContentViewbox"
MaxWidth="{ThemeResource AppBarButtonContentHeight}"
MaxHeight="{ThemeResource AppBarButtonContentHeight}"
Margin="0,12"
HorizontalAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"
StretchDirection="DownOnly">
<ContentPresenter x:Name="Content"
Content="{TemplateBinding Icon}"
Foreground="{TemplateBinding Foreground}" />
</Viewbox>
</um:Ripple>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Define the base style for Material CommandBar -->
<Style x:Key="MaterialBaseCommandBarStyle" TargetType="CommandBar">
<!-- Define the base style for Material CommandBar -->
<Style x:Key="MaterialBaseCommandBarStyle"
TargetType="CommandBar">
<Setter Property="Background" Value="{ThemeResource SurfaceBrush}" />
<Setter Property="Foreground" Value="{ThemeResource OnSurfaceBrush}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<!-- Define the main Material CommandBar Style -->
<Style
x:Key="MaterialCommandBarStyle"
BasedOn="{StaticResource MaterialBaseCommandBarStyle}"
TargetType="CommandBar" />
<!-- Define default styles for AppBarButton and CommandBar -->
<Style
x:Key="MaterialDefaultAppBarButtonStyle"
BasedOn="{StaticResource MaterialAppBarButtonStyle}"
TargetType="AppBarButton" />
<Style
x:Key="MaterialDefaultCommandBarStyle"
BasedOn="{StaticResource MaterialCommandBarStyle}"
TargetType="CommandBar" />
<!-- Define the main Material CommandBar Style -->
<Style x:Key="MaterialCommandBarStyle"
BasedOn="{StaticResource MaterialBaseCommandBarStyle}"
TargetType="CommandBar" />
<!-- Define default styles for AppBarButton and CommandBar -->
<Style x:Key="MaterialDefaultAppBarButtonStyle"
BasedOn="{StaticResource MaterialAppBarButtonStyle}"
TargetType="AppBarButton" />
<Style x:Key="MaterialDefaultCommandBarStyle"
BasedOn="{StaticResource MaterialCommandBarStyle}"
TargetType="CommandBar" />
</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Page x:Class="Uno.Themes.Samples.Content.Controls.CommandBarSamplePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sample="using:Uno.Themes.Samples"
xmlns:android="http:/uno.ui/android"
xmlns:ios="http:/uno.ui/ios"
xmlns:smtx="using:ShowMeTheXAML"
xmlns:toolkit="using:Uno.UI.Toolkit"
mc:Ignorable="d android ios"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sample="using:Uno.Themes.Samples"
xmlns:android="http:/uno.ui/android"
xmlns:ios="http:/uno.ui/ios"
xmlns:smtx="using:ShowMeTheXAML"
mc:Ignorable="d android ios"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<sample:SamplePageLayout>
Expand All @@ -18,14 +17,17 @@
<StackPanel>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<smtx:XamlDisplay Margin="16" UniqueKey="CommandBarSamplePage">
<CommandBar
Content="Command Bar Sample"
Style="{StaticResource MaterialCommandBarStyle}">
<smtx:XamlDisplay Margin="16"
UniqueKey="CommandBarSamplePage">
<CommandBar Content="Command Bar Sample"
Style="{StaticResource MaterialCommandBarStyle}">
<CommandBar.PrimaryCommands>
<AppBarButton Icon="Add" Label="Add" />
<AppBarButton Icon="Edit" Label="Edit" />
<AppBarButton Icon="Delete" Label="Delete" />
<AppBarButton Icon="Add"
Label="Add" />
<AppBarButton Icon="Edit"
Label="Edit" />
<AppBarButton Icon="Delete"
Label="Delete" />
</CommandBar.PrimaryCommands>
</CommandBar>
</smtx:XamlDisplay>
Expand Down

0 comments on commit 1be0ab1

Please sign in to comment.