Skip to content

Commit

Permalink
feat(ProgressBar): lightweight styling for Progress controls
Browse files Browse the repository at this point in the history
  • Loading branch information
Arieldelossantos committed Sep 20, 2023
1 parent d19569b commit 887e25c
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/library/Uno.Material/Styles/Controls/v2/ProgressBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="ProgressBarForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="ProgressBarBackground" ResourceKey="SurfaceVariantBrush" />

<x:Double x:Key="ProgressBarMinWidth">250</x:Double>
<x:Double x:Key="ProgressBarHeight">4</x:Double>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="ProgressBarForeground" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="ProgressBarBackground" ResourceKey="SurfaceVariantBrush" />

<x:Double x:Key="ProgressBarMinWidth">250</x:Double>
<x:Double x:Key="ProgressBarHeight">4</x:Double>
</ResourceDictionary>
Expand Down
15 changes: 6 additions & 9 deletions src/library/Uno.Themes.WinUI.Markup/Theme.Styles.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml;
using Uno.Extensions.Markup.Internals;

namespace Uno.Themes.Markup
Expand Down Expand Up @@ -109,16 +109,13 @@ public static class PipsPager
public static ResourceValue<Style> Default => new("PipsPagerStyle");
}

public static class ProgressBar
public static class RadioButton
{
[ResourceKeyDefinition(typeof(Style), "ProgressBarStyle", TargetType = typeof(ProgressBar))]
public static ResourceValue<Style> Default => new("ProgressBarStyle");
}
[ResourceKeyDefinition(typeof(Style), "RadioButtonStyle", TargetType = typeof(RadioButton))]
public static ResourceValue<Style> Default => new("RadioButtonStyle");

public static class ProgressRing
{
[ResourceKeyDefinition(typeof(Style), "ProgressRingStyle", TargetType = typeof(ProgressRing))]
public static ResourceValue<Style> Default => new("ProgressRingStyle");
[ResourceKeyDefinition(typeof(Style), "SecondaryRadioButtonStyle", TargetType = typeof(RadioButton))]
public static ResourceValue<Style> Secondary => new("SecondaryRadioButtonStyle");
}

public static class Slider
Expand Down
39 changes: 39 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ProgressBar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Uno.Extensions.Markup.Internals;

namespace Uno.Themes.Markup
{
public static partial class Theme
{
public static class ProgressBar
{
public static class Resources
{
public static class Foreground
{
[ResourceKeyDefinition(typeof(Brush), "ProgressBarForeground")]
public static ResourceValue<Brush> Default => new("ProgressBarForeground", true);
}

public static class Background
{
[ResourceKeyDefinition(typeof(Brush), "ProgressBarBackground")]
public static ResourceValue<Brush> Default => new("ProgressBarBackground", true);
}

[ResourceKeyDefinition(typeof(double), "ProgressBarMinWidth")]
public static ResourceValue<double> MinWidth => new("ProgressBarMinWidth", true);

[ResourceKeyDefinition(typeof(double), "ProgressBarHeight")]
public static ResourceValue<double> Height => new("ProgressBarHeight", true);
}

public static class Styles
{
[ResourceKeyDefinition(typeof(Style), "ProgressBarStyle", TargetType = typeof(ProgressBar))]
public static ResourceValue<Style> Default => new("ProgressBarStyle");
}
}
}
}
33 changes: 33 additions & 0 deletions src/library/Uno.Themes.WinUI.Markup/Theme/ProgressRing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Uno.Extensions.Markup.Internals;

namespace Uno.Themes.Markup
{
public static partial class Theme
{
public static class ProgressRing
{
public static class Resources
{
public static class Foreground
{
[ResourceKeyDefinition(typeof(Brush), "ProgressRingForeground")]
public static ResourceValue<Brush> Default => new("ProgressRingForeground", true);
}

public static class Background
{
[ResourceKeyDefinition(typeof(Brush), "ProgressRingBackground")]
public static ResourceValue<Brush> Default => new("ProgressRingBackground", true);
}
}

public static class Styles
{
[ResourceKeyDefinition(typeof(Style), "ProgressRingStyle", TargetType = typeof(ProgressRing))]
public static ResourceValue<Style> Default => new("ProgressRingStyle");
}
}
}
}

0 comments on commit 887e25c

Please sign in to comment.