Skip to content

Commit

Permalink
fix(RatingControl)!: adjust ratingcontrol resource keys (#1350)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: RatingControl Lightweight Styling keys have changed to align the WinUI resoure keys
  • Loading branch information
kazo0 committed Feb 7, 2024
1 parent 186037c commit 24d80ff
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 60 deletions.
3 changes: 2 additions & 1 deletion build/.markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"line-length": false,
"commands-show-output": false,
"no-bare-urls": false,
"no-inline-html": false
"no-inline-html": false,
"no-duplicate-heading": false
}
21 changes: 20 additions & 1 deletion doc/material-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ uid: Uno.Themes.Material.Migration

The version 5.0.0 of Uno.Themes introduced breaking changes on Converters and Control Extensions. If you use one of those items in your project, you will need to do some changes in order to keep using it.

### Converter
### Converters

All Converters were moved to Uno.Themes library, and the new `namespace` is `Uno.Themes`.

Expand Down Expand Up @@ -91,6 +91,25 @@ After:
</Page>
```

### Resources

Certain Lightweight Styling resource keys have been edited to align with those coming from `Microsoft.UI.Xaml`.

#### RatingControl

| Old Key | New Key |
|--------------------------------------------|------------------------------------|
| `RatingControlForegroundUnselected` | `RatingControlUnselectedForeground` |
| `RatingControlForegroundSelected` | `RatingControlSelectedForeground` |
| `RatingControlForegroundPointerOverUnselected` | `RatingControlUnselectedForegroundPointerOver` |
| `RatingControlForegroundPointerOverSelected` | `RatingControlSelectedForegroundPointerOver` |
| `RatingControlForegroundDisabledSelected` | `RatingControlSelectedForegroundDisabled` |
| `SecondaryRatingControlForegroundUnselected` | `SecondaryRatingControlUnselectedForeground` |
| `SecondaryRatingControlForegroundSelected` | `SecondaryRatingControlSelectedForeground` |
| `SecondaryRatingControlForegroundPointerOverUnselected` | `SecondaryRatingControlUnselectedForegroundPointerOver` |
| `SecondaryRatingControlForegroundPointerOverSelected` | `SecondaryRatingControlSelectedForegroundPointerOver` |
| `SecondaryRatingControlForegroundDisabledSelected` | `SecondaryRatingControlSelectedForegroundDisabled` |

### Conclusion

With that, you should be able to update and get it working again for your application. If you've any other issues during the migration, don't hesitate to open an issue in [Uno.Themes GitHub repository](https://github.com/unoplatform/Uno.Themes).
Expand Down
20 changes: 10 additions & 10 deletions doc/styles/RatingControl.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ IsDefaultStyle\*: Styles in this column will be set as the default implicit styl
| `RatingControlCaptionHeight` | `Double` | 32 |
| `SecondaryRatingControlCaptionHeight` | `Double` | 32 |
| `RatingControlForeground` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlForegroundUnselected` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `RatingControlForegroundSelected` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlUnselectedForeground` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `RatingControlSelectedForeground` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlPlaceholderForeground` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `RatingControlPlaceholderForegroundPointerOver` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlForegroundPointerOverUnselected` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlForegroundPointerOverSelected` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlForegroundDisabledSelected` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `RatingControlUnselectedForegroundPointerOver` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlSelectedForegroundPointerOver` | `SolidColorBrush` | `PrimaryBrush` |
| `RatingControlSelectedForegroundDisabled` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `SecondaryRatingControlForeground` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlForegroundUnselected` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `SecondaryRatingControlForegroundSelected` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlUnselectedForeground` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `SecondaryRatingControlSelectedForeground` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlPlaceholderForeground` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `SecondaryRatingControlPlaceholderForegroundPointerOver` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlForegroundPointerOverUnselected` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlForegroundPointerOverSelected` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlForegroundDisabledSelected` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `SecondaryRatingControlUnselectedForegroundPointerOver` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlSelectedForegroundPointerOver` | `SolidColorBrush` | `SecondaryBrush` |
| `SecondaryRatingControlSelectedForegroundDisabled` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `RatingControlCaptionForeground` | `SolidColorBrush` | `OnSurfaceBrush` |
| `RatingControlCaptionFontFamily` | `FontFamily` | `MaterialRegularFontFamily` |
| `RatingControlCaptionStyle` | `StaticResourceRef` | `CaptionMedium` |
Expand Down
56 changes: 28 additions & 28 deletions src/library/Uno.Material/Styles/Controls/v2/RatingControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@

<!-- Default -->
<StaticResource x:Key="RatingControlForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundUnselected" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlForegroundUnselectedPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundSelected" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundSelectedPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundSelectedDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlUnselectedForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlUnselectedForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlSelectedForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlSelectedForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlSelectedForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlPlaceholderForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlPlaceholderForegroundPointerOver" ResourceKey="PrimaryBrush" />

<!-- Secondary -->
<StaticResource x:Key="SecondaryRatingControlForeground" ResourceKey="SecondaryBrush" />

<StaticResource x:Key="SecondaryRatingControlForegroundUnselected" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundSelected" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlUnselectedForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlSelectedForeground" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlPlaceholderForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlPlaceholderForegroundPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundUnselectedPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundSelectedPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundSelectedDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlUnselectedForegroundPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlSelectedForegroundPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlSelectedForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />

<!-- Caption and Fonts -->
<StaticResource x:Key="RatingControlCaptionForeground" ResourceKey="OnSurfaceBrush" />
Expand All @@ -51,24 +51,24 @@
<!-- Default -->
<StaticResource x:Key="RatingControlForeground" ResourceKey="PrimaryBrush" />

<StaticResource x:Key="RatingControlForegroundUnselected" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlForegroundSelected" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlUnselectedForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlSelectedForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlPlaceholderForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlPlaceholderForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundUnselectedPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundSelectedPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlForegroundSelectedDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="RatingControlUnselectedForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlSelectedForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="RatingControlSelectedForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />

<!-- Secondary -->
<StaticResource x:Key="SecondaryRatingControlForeground" ResourceKey="SecondaryBrush" />

<StaticResource x:Key="SecondaryRatingControlForegroundUnselected" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundSelected" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlUnselectedForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlSelectedForeground" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlPlaceholderForeground" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlPlaceholderForegroundPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundUnselectedPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundSelectedPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlForegroundSelectedDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="SecondaryRatingControlUnselectedForegroundPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlSelectedForegroundPointerOver" ResourceKey="SecondaryBrush" />
<StaticResource x:Key="SecondaryRatingControlSelectedForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />

<!-- Caption and Fonts -->
<StaticResource x:Key="RatingControlCaptionForeground" ResourceKey="OnSurfaceBrush" />
Expand Down Expand Up @@ -99,7 +99,7 @@
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlForegroundSelectedDisabled}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlSelectedForegroundDisabled}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Placeholder">
Expand All @@ -114,17 +114,17 @@
</VisualState>
<VisualState x:Name="PointerOverUnselected">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlForegroundUnselectedPointerOver}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlUnselectedForegroundPointerOver}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Set">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlForegroundSelected}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlSelectedForeground}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOverSet">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlForegroundSelected}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource RatingControlSelectedForeground}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down Expand Up @@ -189,7 +189,7 @@
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlForegroundSelectedDisabled}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlSelectedForegroundDisabled}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Placeholder">
Expand All @@ -204,17 +204,17 @@
</VisualState>
<VisualState x:Name="PointerOverUnselected">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlForegroundUnselectedPointerOver}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlUnselectedForegroundPointerOver}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Set">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlForegroundSelected}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlSelectedForeground}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOverSet">
<VisualState.Setters>
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlForegroundSelected}" />
<Setter Target="ForegroundContentPresenter.Foreground" Value="{ThemeResource SecondaryRatingControlSelectedForeground}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
Expand Down
40 changes: 20 additions & 20 deletions src/library/Uno.Themes.WinUI.Markup/Theme/RatingControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ public static partial class Foreground
public static ThemeResourceKey<Brush> Default => new("RatingControlForeground");


[ResourceKeyDefinition(typeof(Brush), "RatingControlForegroundUnselected")]
public static ThemeResourceKey<Brush> Unselected => new("RatingControlForegroundUnselected");
[ResourceKeyDefinition(typeof(Brush), "RatingControlUnselectedForeground")]
public static ThemeResourceKey<Brush> Unselected => new("RatingControlUnselectedForeground");

[ResourceKeyDefinition(typeof(Brush), "RatingControlForegroundUnselectedPointerOver")]
public static ThemeResourceKey<Brush> UnselectedPointerOver => new("RatingControlForegroundUnselectedPointerOver");
[ResourceKeyDefinition(typeof(Brush), "RatingControlUnselectedForegroundPointerOver")]
public static ThemeResourceKey<Brush> UnselectedPointerOver => new("RatingControlUnselectedForegroundPointerOver");

[ResourceKeyDefinition(typeof(Brush), "RatingControlForegroundSelected")]
public static ThemeResourceKey<Brush> Selected => new("RatingControlForegroundSelected");
[ResourceKeyDefinition(typeof(Brush), "RatingControlSelectedForeground")]
public static ThemeResourceKey<Brush> Selected => new("RatingControlSelectedForeground");

[ResourceKeyDefinition(typeof(Brush), "RatingControlForegroundSelectedPointerOver")]
public static ThemeResourceKey<Brush> SelectedPointerOver => new("RatingControlForegroundSelectedPointerOver");
[ResourceKeyDefinition(typeof(Brush), "RatingControlSelectedForegroundPointerOver")]
public static ThemeResourceKey<Brush> SelectedPointerOver => new("RatingControlSelectedForegroundPointerOver");

[ResourceKeyDefinition(typeof(Brush), "RatingControlForegroundSelectedDisabled")]
public static ThemeResourceKey<Brush> SelectedDisabled => new("RatingControlForegroundSelectedDisabled");
[ResourceKeyDefinition(typeof(Brush), "RatingControlSelectedForegroundDisabled")]
public static ThemeResourceKey<Brush> SelectedDisabled => new("RatingControlSelectedForegroundDisabled");
}

public static partial class PlaceholderForeground
Expand Down Expand Up @@ -79,20 +79,20 @@ public static partial class Foreground
public static ThemeResourceKey<Brush> Default => new("SecondaryRatingControlForeground");


[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlForegroundUnselected")]
public static ThemeResourceKey<Brush> Unselected => new("SecondaryRatingControlForegroundUnselected");
[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlUnselectedForeground")]
public static ThemeResourceKey<Brush> Unselected => new("SecondaryRatingControlUnselectedForeground");

[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlForegroundUnselectedPointerOver")]
public static ThemeResourceKey<Brush> UnselectedPointerOver => new("SecondaryRatingControlForegroundUnselectedPointerOver");
[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlUnselectedForegroundPointerOver")]
public static ThemeResourceKey<Brush> UnselectedPointerOver => new("SecondaryRatingControlUnselectedForegroundPointerOver");

[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlForegroundSelected")]
public static ThemeResourceKey<Brush> Selected => new("SecondaryRatingControlForegroundSelected");
[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlSelectedForeground")]
public static ThemeResourceKey<Brush> Selected => new("SecondaryRatingControlSelectedForeground");

[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlForegroundSelectedPointerOver")]
public static ThemeResourceKey<Brush> SelectedPointerOver => new("SecondaryRatingControlForegroundSelectedPointerOver");
[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlSelectedForegroundPointerOver")]
public static ThemeResourceKey<Brush> SelectedPointerOver => new("SecondaryRatingControlSelectedForegroundPointerOver");

[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlForegroundSelectedDisabled")]
public static ThemeResourceKey<Brush> SelectedDisabled => new("SecondaryRatingControlForegroundSelectedDisabled");
[ResourceKeyDefinition(typeof(Brush), "SecondaryRatingControlSelectedForegroundDisabled")]
public static ThemeResourceKey<Brush> SelectedDisabled => new("SecondaryRatingControlSelectedForegroundDisabled");
}

public static partial class PlaceholderForeground
Expand Down

0 comments on commit 24d80ff

Please sign in to comment.