Skip to content

Commit

Permalink
chore(markup): update c#markup (#1232)
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Bilogan <[email protected]>
  • Loading branch information
Xiaoy312 and kazo0 authored Oct 26, 2023
1 parent 22d0694 commit 6640857
Show file tree
Hide file tree
Showing 43 changed files with 3,427 additions and 3,271 deletions.
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
<IsMarkupProject>$(MSBuildProjectName.Contains('Markup'))</IsMarkupProject>
</PropertyGroup>

<ItemGroup>
Expand All @@ -42,6 +43,10 @@
</When>
</Choose>

<PropertyGroup Condition="'$(IsMarkupProject)'=='true'">
<IsPackable>true</IsPackable>
</PropertyGroup>

<!-- Workaround for https://developercommunity.visualstudio.com/t/XamarinMac-binaries-are-missing-in-173/10164443 -->
<ItemGroup Condition="$(TargetFramework.ToLower().StartsWith('xamarinmac')) and '$(Configuration)' == 'Release' and '$(OS)'=='Windows_NT'">
<Reference Include="Xamarin.Mac">
Expand Down
2 changes: 1 addition & 1 deletion doc/styles/Slider.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SliderBottomTickBarHeight|Double|4
SliderHorizontalInlineTickBarHeight|Double|2
SliderLeftTickBarWidth|Double|4
SliderRightTickBarWidth|Double|4
SliderVerticallInlineTickBarWidth|Double|2
SliderVerticalInlineTickBarWidth|Double|2
SliderTopTickBarMargin|Thickness|0,0,0,4
SliderBottomTickBarMargin|Thickness|0,4,0,0
SliderLeftTickBarMargin|Thickness|0,0,4,0
Expand Down
18 changes: 9 additions & 9 deletions doc/styles/ToggleButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ TextToggleButtonBackgroundIndeterminate|SolidColorBrush|SystemControlTransparent
TextToggleButtonBackgroundIndeterminatePointerOver|SolidColorBrush|SystemControlTransparentBrush
TextToggleButtonBackgroundIndeterminatePressed|SolidColorBrush|SystemControlTransparentBrush
TextToggleButtonBackgroundIndeterminateDisabled|SolidColorBrush|SystemControlTransparentBrush
TextToggleButtonForeground|Color|PrimaryColor
TextToggleButtonForegroundPointerOver|Color|PrimaryColor
TextToggleButtonForegroundPressed|Color|PrimaryColor
TextToggleButtonForeground|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundPointerOver|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundPressed|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundDisabled|SolidColorBrush|OnSurfaceLowBrush
TextToggleButtonForegroundChecked|Color|PrimaryColor
TextToggleButtonForegroundCheckedPointerOver|Color|PrimaryColor
TextToggleButtonForegroundCheckedPressed|Color|PrimaryColor
TextToggleButtonForegroundChecked|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundCheckedPointerOver|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundCheckedPressed|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundCheckedDisabled|SolidColorBrush|OnSurfaceLowBrush
TextToggleButtonForegroundIndeterminate|Color|PrimaryColor
TextToggleButtonForegroundIndeterminatePointerOver|Color|PrimaryColor
TextToggleButtonForegroundIndeterminatePressed|Color|PrimaryColor
TextToggleButtonForegroundIndeterminate|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundIndeterminatePointerOver|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundIndeterminatePressed|SolidColorBrush|PrimaryBrush
TextToggleButtonForegroundIndeterminateDisabled|SolidColorBrush|OnSurfaceLowBrush
TextToggleButtonFontFamily|FontFamily|MaterialRegularFontFamily
TextToggleButtonFontSize|Double|LabelLargeFontSize
Expand Down
33 changes: 14 additions & 19 deletions src/library/Uno.Material.WinUI.Markup/MarkupInit.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.UI.Xaml;
using Uno.Extensions.Markup;
using Microsoft.UI.Xaml;

namespace Uno.Material
namespace Uno.Material.Markup;

public static class MarkupInit
{
public static class MarkupInit
{
public static T UseMaterial<T>(this T app,
ResourceDictionary colorOverride = null,
ResourceDictionary fontOverride = null) where T : Application
=> app.Resources(
r => r.Merged(
new MaterialTheme()
.ColorOverrideDictionary(colorOverride)
.FontOverrideDictionary(fontOverride)
)
);
}
public static T UseMaterial<T>(this T app,
ResourceDictionary colorOverride = null,
ResourceDictionary fontOverride = null) where T : Application
=> app.Resources(
r => r.Merged(
new MaterialTheme()
.ColorOverrideDictionary(colorOverride)
.FontOverrideDictionary(fontOverride)
)
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">
<Project Sdk="MSBuild.Sdk.Extras/3.0.44">

<!--
Adding project references to this project requires some manual adjustments.
Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Uno.Extensions.Markup.Generators" PrivateAssets="All" Version="5.0.0-dev.407" />
<PackageReference Include="Uno.Extensions.Markup.Generators" PrivateAssets="All" Version="5.0.0-dev.517" />
</ItemGroup>

<PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/library/Uno.Material/Styles/Controls/v2/CalendarView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
mc:Ignorable="not_win">

<x:String x:Key="MaterialDownArrowPathData">M0,0L32,0 16,19.745z</x:String>
<SolidColorBrush x:Key="MaterialCalendarTodayForeground"
<SolidColorBrush x:Key="MaterialCalendarViewTodayForeground"
Color="{ThemeResource OnSurfaceColor}"
Opacity="0.87" />
<SolidColorBrush x:Key="MaterialCalendarBlackoutForeground"
<SolidColorBrush x:Key="MaterialCalendarViewBlackoutForeground"
Color="{ThemeResource OnSurfaceColor}"
Opacity="0.38" />

Expand All @@ -31,9 +31,9 @@
<Setter Property="CalendarItemBorderBrush"
Value="{ThemeResource CalendarViewCalendarItemRevealBorderBrush}" />
<Setter Property="TodayForeground"
Value="{StaticResource MaterialCalendarTodayForeground}" />
Value="{StaticResource MaterialCalendarViewTodayForeground}" />
<Setter Property="BlackoutForeground"
Value="{ThemeResource MaterialCalendarBlackoutForeground}" />
Value="{StaticResource MaterialCalendarViewBlackoutForeground}" />
<Setter Property="SelectedForeground"
Value="{ThemeResource OnPrimaryBrush}" />
<Setter Property="PressedForeground"
Expand Down
27 changes: 17 additions & 10 deletions src/library/Uno.Material/Styles/Controls/v2/CheckBox.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:um="using:Uno.Material"
Expand Down Expand Up @@ -65,6 +65,7 @@
<!-- endregion -->

<!--#region Check Background Stroke-->
<StaticResource x:Key="CheckBoxCheckBackgroundStroke" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundStrokeUnchecked" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundStrokeUncheckedPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundStrokeUncheckedPressed" ResourceKey="OnSurfaceBrush" />
Expand All @@ -82,6 +83,7 @@
<!--#endregion-->

<!--#region Check Background Fill-->
<StaticResource x:Key="CheckBoxCheckBackgroundFill" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundFillUnchecked" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundFillUncheckedPointerOver" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundFillUncheckedPressed" ResourceKey="SystemControlTransparentBrush" />
Expand All @@ -106,6 +108,7 @@
<!--#endregion-->

<!--#region Glyph-->
<StaticResource x:Key="CheckBoxGlyphForeground" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxGlyphForegroundUnchecked" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxGlyphForegroundUncheckedPointerOver" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxGlyphForegroundUncheckedPressed" ResourceKey="SystemControlTransparentBrush" />
Expand All @@ -127,7 +130,6 @@

<!--#region States-->
<StaticResource x:Key="CheckBoxStateCircleFillUnchecked" ResourceKey="OnSurfaceBrush" />

<StaticResource x:Key="CheckBoxStateCircleFillChecked" ResourceKey="PrimaryBrush" />

<StaticResource x:Key="CheckBoxStateCircleOpacityPointerOver" ResourceKey="HoverOpacity" />
Expand Down Expand Up @@ -202,6 +204,7 @@
<!-- endregion -->

<!--#region Check Background Stroke-->
<StaticResource x:Key="CheckBoxCheckBackgroundStroke" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundStrokeUnchecked" ResourceKey="OnSurfaceVariantBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundStrokeUncheckedPointerOver" ResourceKey="OnSurfaceBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundStrokeUncheckedPressed" ResourceKey="OnSurfaceBrush" />
Expand All @@ -219,6 +222,7 @@
<!--#endregion-->

<!--#region Check Background Fill-->
<StaticResource x:Key="CheckBoxCheckBackgroundFill" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundFillUnchecked" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundFillUncheckedPointerOver" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxCheckBackgroundFillUncheckedPressed" ResourceKey="SystemControlTransparentBrush" />
Expand All @@ -243,6 +247,8 @@
<!--#endregion-->

<!--#region Glyph-->
<StaticResource x:Key="CheckBoxGlyphForeground" ResourceKey="SystemControlTransparentBrush" />

<StaticResource x:Key="CheckBoxGlyphForegroundUnchecked" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxGlyphForegroundUncheckedPointerOver" ResourceKey="SystemControlTransparentBrush" />
<StaticResource x:Key="CheckBoxGlyphForegroundUncheckedPressed" ResourceKey="SystemControlTransparentBrush" />
Expand All @@ -264,7 +270,6 @@

<!--#region States-->
<StaticResource x:Key="CheckBoxStateCircleFillUnchecked" ResourceKey="OnSurfaceBrush" />

<StaticResource x:Key="CheckBoxStateCircleFillChecked" ResourceKey="PrimaryBrush" />

<StaticResource x:Key="CheckBoxStateCircleOpacityPointerOver" ResourceKey="HoverOpacity" />
Expand Down Expand Up @@ -514,7 +519,9 @@
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="UncheckedFocusStateCircle.Fill" Value="{ThemeResource CheckBoxStateCircleFillUnchecked}" />
<Setter Target="UncheckedFocusStateCircle.Opacity" Value="{ThemeResource CheckBoxStateCircleOpacityFocused}" />
<Setter Target="CheckedFocusStateCircle.Fill" Value="{ThemeResource CheckBoxStateCircleFillChecked}" />
<Setter Target="CheckedFocusStateCircle.Opacity" Value="{ThemeResource CheckBoxStateCircleOpacityFocused}" />
</VisualState.Setters>
</VisualState>
Expand All @@ -536,7 +543,7 @@
Stretch="Uniform"
Width="{ThemeResource CheckBoxFocusAreaSize}"
Height="{ThemeResource CheckBoxFocusAreaSize}"
Fill="{ThemeResource CheckBoxStateCircleFillUnchecked}"
Fill="Transparent"
Visibility="{Binding IsChecked, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource CheckBoxIsCheckedToFocusStateCircleCollapsed}, TargetNullValue=Collapsed, FallbackValue=Collapsed}"
IsHitTestVisible="False"
Opacity="0" />
Expand All @@ -547,7 +554,7 @@
Stretch="Uniform"
Width="{ThemeResource CheckBoxFocusAreaSize}"
Height="{ThemeResource CheckBoxFocusAreaSize}"
Fill="{ThemeResource CheckBoxStateCircleFillChecked}"
Fill="Transparent"
Visibility="{Binding IsChecked, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource CheckBoxIsCheckedToFocusStateCircleVisible}, TargetNullValue=Collapsed, FallbackValue=Collapsed}"
IsHitTestVisible="False"
Opacity="0" />
Expand All @@ -558,7 +565,7 @@
Stretch="Uniform"
Width="{ThemeResource CheckBoxFocusAreaSize}"
Height="{ThemeResource CheckBoxFocusAreaSize}"
Fill="{ThemeResource CheckBoxStateCircleFillChecked}"
Fill="Transparent"
IsHitTestVisible="False"
Opacity="0" />

Expand All @@ -568,13 +575,13 @@
CornerRadius="{TemplateBinding CornerRadius}">

<Grid x:Name="BackgroundBorder"
Background="{ThemeResource CheckBoxCheckBackgroundFillUnchecked}"
BorderBrush="{ThemeResource CheckBoxCheckBackgroundStrokeUnchecked}"
Background="{ThemeResource CheckBoxCheckBackgroundFill}"
BorderBrush="{ThemeResource CheckBoxCheckBackgroundStroke}"
BorderThickness="{ThemeResource CheckBoxCheckAreaBorderThickness}" />

<Path x:Name="HyphenGlyph"
Data="{ThemeResource CheckBoxHyphenGlyphPathData}"
Fill="{ThemeResource CheckBoxGlyphForegroundIndeterminate}"
Fill="{ThemeResource CheckBoxGlyphForeground}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"
Expand All @@ -586,7 +593,7 @@

<Path x:Name="CheckGlyph"
Data="{ThemeResource CheckBoxCheckGlyphPathData}"
Fill="{ThemeResource CheckBoxGlyphForegroundChecked}"
Fill="{ThemeResource CheckBoxGlyphForeground}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Stretch="Uniform"
Expand Down
6 changes: 3 additions & 3 deletions src/library/Uno.Material/Styles/Controls/v2/Slider.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<x:Double x:Key="SliderHorizontalInlineTickBarHeight">2</x:Double>
<x:Double x:Key="SliderLeftTickBarWidth">4</x:Double>
<x:Double x:Key="SliderRightTickBarWidth">4</x:Double>
<x:Double x:Key="SliderVerticallInlineTickBarWidth">2</x:Double>
<x:Double x:Key="SliderVerticalInlineTickBarWidth">2</x:Double>
<Thickness x:Key="SliderTopTickBarMargin">0,0,0,4</Thickness>
<Thickness x:Key="SliderBottomTickBarMargin">0,4,0,0</Thickness>
<Thickness x:Key="SliderLeftTickBarMargin">0,0,4,0</Thickness>
Expand Down Expand Up @@ -84,7 +84,7 @@
<x:Double x:Key="SliderHorizontalInlineTickBarHeight">2</x:Double>
<x:Double x:Key="SliderLeftTickBarWidth">4</x:Double>
<x:Double x:Key="SliderRightTickBarWidth">4</x:Double>
<x:Double x:Key="SliderVerticallInlineTickBarWidth">2</x:Double>
<x:Double x:Key="SliderVerticalInlineTickBarWidth">2</x:Double>
<Thickness x:Key="SliderTopTickBarMargin">0,0,0,4</Thickness>
<Thickness x:Key="SliderBottomTickBarMargin">0,4,0,0</Thickness>
<Thickness x:Key="SliderLeftTickBarMargin">0,0,4,0</Thickness>
Expand Down Expand Up @@ -334,7 +334,7 @@
<TickBar x:Name="VerticalInlineTickBar"
Grid.RowSpan="3"
Grid.Column="1"
Width="{ThemeResource SliderVerticallInlineTickBarWidth}"
Width="{ThemeResource SliderVerticalInlineTickBarWidth}"
Fill="{ThemeResource SliderInlineTickBarFill}"
Visibility="Collapsed" />

Expand Down
36 changes: 18 additions & 18 deletions src/library/Uno.Material/Styles/Controls/v2/ToggleButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
<!--#endregion-->

<!--#region Foreground-->
<StaticResource x:Key="TextToggleButtonForeground" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundPointerOver" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundPressed" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundPressed" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="TextToggleButtonForegroundChecked" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPointerOver" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPressed" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundChecked" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPressed" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminate" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePointerOver" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePressed" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminate" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePressed" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminateDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->

Expand Down Expand Up @@ -153,17 +153,17 @@
<!--#endregion-->

<!--#region Foreground-->
<StaticResource x:Key="TextToggleButtonForeground" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundPointerOver" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundPressed" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundPressed" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="TextToggleButtonForegroundChecked" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPointerOver" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPressed" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundChecked" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedPressed" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundCheckedDisabled" ResourceKey="OnSurfaceLowBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminate" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePointerOver" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePressed" ResourceKey="PrimaryColor" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminate" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePointerOver" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminatePressed" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="TextToggleButtonForegroundIndeterminateDisabled" ResourceKey="OnSurfaceLowBrush" />
<!--#endregion-->

Expand Down
Loading

0 comments on commit 6640857

Please sign in to comment.