Skip to content

Commit

Permalink
fix: Fixes Material Card themed backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
lesterbotello committed May 25, 2023
1 parent cccd79f commit ebbde41
Showing 1 changed file with 50 additions and 30 deletions.
80 changes: 50 additions & 30 deletions src/library/Uno.Toolkit.Material/Styles/Controls/v2/Card.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,44 @@
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:um="using:Uno.Material"
xmlns:toolkit="using:Uno.UI.Toolkit">

<!-- Card Brushes Resources -->
<!-- Elevated -->
<StaticResource x:Key="MaterialElevatedCardBackground"
ResourceKey="SurfaceBrush" />

<!-- Filled -->
<StaticResource x:Key="MaterialFilledCardBackground"
ResourceKey="SurfaceVariantBrush" />

<!-- Outlined -->
<StaticResource x:Key="MaterialOutlinedCardBackground"
ResourceKey="SurfaceBrush" />
<StaticResource x:Key="MaterialOutlinedCardBorderBrush"
ResourceKey="OutlineBrush" />

<!-- Card Other Resources -->
<!-- Double -->
<ResourceDictionary.ThemeDictionaries>
<!-- Card Brushes Theme Resources -->
<ResourceDictionary x:Key="Default">
<!-- Filled -->
<StaticResource x:Key="MaterialFilledCardBackground"
ResourceKey="SurfaceBrush" />

<!-- Outlined -->
<StaticResource x:Key="MaterialOutlinedCardBackground"
ResourceKey="SurfaceBrush" />

<!-- Elevated -->
<StaticResource x:Key="MaterialElevatedCardBackground"
ResourceKey="SurfaceBrush" />
</ResourceDictionary>

<ResourceDictionary x:Key="Light">
<!-- Filled -->
<StaticResource x:Key="MaterialFilledCardBackground"
ResourceKey="SurfaceBrush" />

<!-- Outlined -->
<StaticResource x:Key="MaterialOutlinedCardBackground"
ResourceKey="SurfaceBrush" />

<!-- Elevated -->
<StaticResource x:Key="MaterialElevatedCardBackground"
ResourceKey="SurfaceBrush" />
</ResourceDictionary>

<ResourceDictionary x:Key="HighContrast" />
</ResourceDictionary.ThemeDictionaries>

<!-- Card Other Resources -->
<StaticResource x:Key="MaterialOutlinedCardBorderBrush"
ResourceKey="OutlineBrush" />

<!-- Double -->
<x:Double x:Key="MaterialCardMinHeight">72</x:Double>
<x:Double x:Key="MaterialCardMaxWidth">344</x:Double>

Expand Down Expand Up @@ -154,7 +174,7 @@
TargetType="utu:Card"
BasedOn="{StaticResource MaterialBaseCardStyle}">
<Setter Property="Background"
Value="{StaticResource MaterialFilledCardBackground}" />
Value="{ThemeResource MaterialFilledCardBackground}" />
<Setter Property="VerticalAlignment"
Value="Stretch" />
<Setter Property="VerticalContentAlignment"
Expand Down Expand Up @@ -337,9 +357,9 @@
BasedOn="{StaticResource MaterialFilledCardStyle}">

<Setter Property="Background"
Value="{StaticResource MaterialOutlinedCardBackground}" />
Value="{ThemeResource MaterialOutlinedCardBackground}" />
<Setter Property="BorderBrush"
Value="{ThemeResource MaterialOutlinedCardBorderBrush}" />
Value="{StaticResource MaterialOutlinedCardBorderBrush}" />
<Setter Property="BorderThickness"
Value="{StaticResource MaterialCardBorderThickness}" />
</Style>
Expand All @@ -348,7 +368,7 @@
BasedOn="{StaticResource MaterialBaseCardStyle}"
TargetType="utu:Card">
<Setter Property="Background"
Value="{StaticResource MaterialElevatedCardBackground}" />
Value="{ThemeResource MaterialElevatedCardBackground}" />
<Setter Property="VerticalAlignment"
Value="Stretch" />
<Setter Property="VerticalContentAlignment"
Expand Down Expand Up @@ -534,7 +554,7 @@
TargetType="utu:Card">

<Setter Property="Background"
Value="{StaticResource MaterialFilledCardBackground}" />
Value="{ThemeResource MaterialFilledCardBackground}" />

<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -733,9 +753,9 @@
TargetType="utu:Card">

<Setter Property="Background"
Value="{StaticResource MaterialOutlinedCardBackground}" />
Value="{ThemeResource MaterialOutlinedCardBackground}" />
<Setter Property="BorderBrush"
Value="{ThemeResource MaterialOutlinedCardBorderBrush}" />
Value="{StaticResource MaterialOutlinedCardBorderBrush}" />
<Setter Property="BorderThickness"
Value="{StaticResource MaterialCardBorderThickness}" />
</Style>
Expand All @@ -745,7 +765,7 @@
TargetType="utu:Card">

<Setter Property="Background"
Value="{StaticResource MaterialElevatedCardBackground}" />
Value="{ThemeResource MaterialElevatedCardBackground}" />
<Setter Property="Elevation"
Value="{StaticResource MaterialCardElevation}" />

Expand Down Expand Up @@ -949,7 +969,7 @@
TargetType="utu:Card">

<Setter Property="Background"
Value="{StaticResource MaterialFilledCardBackground}" />
Value="{ThemeResource MaterialFilledCardBackground}" />

<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -1137,9 +1157,9 @@
<Setter Property="Padding"
Value="0" />
<Setter Property="Background"
Value="{StaticResource MaterialOutlinedCardBackground}" />
Value="{ThemeResource MaterialOutlinedCardBackground}" />
<Setter Property="BorderBrush"
Value="{ThemeResource MaterialOutlinedCardBorderBrush}" />
Value="{StaticResource MaterialOutlinedCardBorderBrush}" />
<Setter Property="BorderThickness"
Value="{StaticResource MaterialCardBorderThickness}" />
</Style>
Expand All @@ -1149,7 +1169,7 @@
TargetType="utu:Card">

<Setter Property="Background"
Value="{StaticResource MaterialElevatedCardBackground}" />
Value="{ThemeResource MaterialElevatedCardBackground}" />
<Setter Property="Elevation"
Value="{StaticResource MaterialCardElevation}" />

Expand Down

0 comments on commit ebbde41

Please sign in to comment.