Skip to content

Commit

Permalink
fix: Fixes Material Card themed backgrounds (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesterbotello authored Jun 1, 2023
1 parent 7284d3f commit 3cf9c00
Showing 1 changed file with 49 additions and 27 deletions.
76 changes: 49 additions & 27 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,46 @@
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" />

<!-- Card Other Resources -->
<StaticResource x:Key="MaterialOutlinedCardBorderBrush"
ResourceKey="OutlineBrush" />
</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" />

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

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

Expand Down Expand Up @@ -154,7 +176,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,7 +359,7 @@
BasedOn="{StaticResource MaterialFilledCardStyle}">

<Setter Property="Background"
Value="{StaticResource MaterialOutlinedCardBackground}" />
Value="{ThemeResource MaterialOutlinedCardBackground}" />
<Setter Property="BorderBrush"
Value="{ThemeResource MaterialOutlinedCardBorderBrush}" />
<Setter Property="BorderThickness"
Expand All @@ -348,7 +370,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 +556,7 @@
TargetType="utu:Card">

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

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

<Setter Property="Background"
Value="{StaticResource MaterialOutlinedCardBackground}" />
Value="{ThemeResource MaterialOutlinedCardBackground}" />
<Setter Property="BorderBrush"
Value="{ThemeResource MaterialOutlinedCardBorderBrush}" />
<Setter Property="BorderThickness"
Expand All @@ -745,7 +767,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 +971,7 @@
TargetType="utu:Card">

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

<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -1137,7 +1159,7 @@
<Setter Property="Padding"
Value="0" />
<Setter Property="Background"
Value="{StaticResource MaterialOutlinedCardBackground}" />
Value="{ThemeResource MaterialOutlinedCardBackground}" />
<Setter Property="BorderBrush"
Value="{ThemeResource MaterialOutlinedCardBorderBrush}" />
<Setter Property="BorderThickness"
Expand All @@ -1149,7 +1171,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 3cf9c00

Please sign in to comment.