10 | This is the demo project you can use it as a reference or starter for your own MicaWPF app.
11 | Just download/clone this project and run it.
12 |
13 |
--------------------------------------------------------------------------------
/src/MicaWPF.DependencyInjection/Helpers/DependencyInjectionHelper.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System;
6 | using MicaWPF.Core.Services;
7 | using MicaWPF.DependencyInjection.Options;
8 | using MicaWPF.DependencyInjection.Services;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using Microsoft.Extensions.DependencyInjection.Extensions;
11 | using Microsoft.Extensions.Hosting;
12 |
13 | namespace MicaWPF.DependencyInjection.Helpers;
14 |
15 | public static class DependencyInjectionHelper
16 | {
17 | ///
18 | /// Adds MicaWPF services to the host builder.
19 | /// MicaWPF is a set of services that provide theme and accent color
20 | /// functionality to a WPF application.
21 | /// The `options` parameter can be used to configure the behavior of
22 | /// MicaWPF.
23 | ///
24 | /// The host builder instance to add MicaWPF services to.
25 | /// An optional action that can be used to configure MicaWPF options.
26 | /// The original host builder instance.
27 | public static IHostBuilder UseMicaWPF(this IHostBuilder builder, Action? options = null)
28 | {
29 | #if NET5_0_OR_GREATER
30 | ArgumentNullException.ThrowIfNull(builder);
31 | #else
32 | if (builder is null)
33 | {
34 | throw new ArgumentNullException(nameof(builder));
35 | }
36 | #endif
37 |
38 | var cfg = new MicaWPFOptions();
39 |
40 | options?.Invoke(cfg);
41 |
42 | builder.ConfigureServices((_, services) =>
43 | {
44 | services.TryAddSingleton(cfg);
45 | services.TryAddSingleton();
46 | services.TryAddSingleton();
47 | });
48 |
49 | return builder;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/MicaWPF.DependencyInjection/MicaWPF.DependencyInjection.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net461;net47;net48;net481;netcoreapp3.1;net6.0-windows;net7.0-windows;net8.0-windows;net9.0-windows
5 | 7.0
6 | true
7 | Copyright (c) 2021 Simnico99
8 | https://github.com/Simnico99/MicaWPF
9 | git
10 | MicaWPF;WPF;Mica;WinUI;wpfui;UI;windows;controls;custom;modern;xaml;toolkit;color;dark;theme;Simnico99;net6;net5;net;fluent;acrylic
11 | True
12 | enable
13 | https://github.com/Simnico99/MicaWPF
14 | en
15 | latest
16 | enable
17 | MIT
18 | True
19 | MicaWPFLogo - 128x128.png
20 | Simnico99
21 | An extension of MicaWPF that adds dependency injection support.
22 | ReadmeNuget.md
23 | true
24 | true
25 | snupkg
26 | true
27 | true
28 |
29 |
30 |
31 | true
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | True
41 | \
42 |
43 |
44 | True
45 | \
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | all
65 | runtime; build; native; contentfiles; analyzers; buildtransitive
66 |
67 |
68 | all
69 | runtime; build; native; contentfiles; analyzers; buildtransitive
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/MicaWPF.DependencyInjection/Options/MicaWPFOptions.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows.Media;
6 | using MicaWPF.Core.Enums;
7 |
8 | namespace MicaWPF.DependencyInjection.Options;
9 |
10 | ///
11 | /// Represents options for the MicaWPF services.
12 | ///
13 | public sealed class MicaWPFOptions
14 | {
15 | ///
16 | /// Gets or sets a value indicating whether the title bar and borders should automatically match the accent border setting in windows.
17 | ///
18 | public bool IsTitleBarAndBorderAccentAware { get; set; } = true;
19 |
20 | ///
21 | /// Gets or sets a value indicating whether the application should automatically match the current system theme.
22 | ///
23 | public bool IsThemeAware { get; set; } = true;
24 |
25 | ///
26 | /// Gets or sets a value indicating whether the accent color should be updated from Windows.
27 | ///
28 | public bool UpdateAccentFromWindows { get; set; } = true;
29 |
30 | ///
31 | /// Gets or sets the theme to use in the application.
32 | ///
33 | public WindowsTheme Theme { get; set; } = WindowsTheme.Auto;
34 |
35 | ///
36 | /// Gets or sets the accent color to use in the application.
37 | ///
38 | public Color AccentColor { get; set; } = default;
39 | }
--------------------------------------------------------------------------------
/src/MicaWPF.DependencyInjection/Services/AccentColorServiceDI.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Media;
7 | using MicaWPF.Core.Events;
8 | using MicaWPF.Core.Helpers;
9 | using MicaWPF.Core.Models;
10 | using MicaWPF.Core.Services;
11 | using MicaWPF.DependencyInjection.Options;
12 |
13 | namespace MicaWPF.DependencyInjection.Services;
14 |
15 | ///
16 | /// The AccentColorService through dependency injection.
17 | ///
18 | internal sealed class AccentColorServiceDI : IAccentColorService
19 | {
20 | private readonly MicaWPFOptions _options;
21 | private readonly IAccentColorService _accentColorService = MicaWPFServiceUtility.AccentColorService;
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | /// MicaWPF options.
27 | public AccentColorServiceDI(MicaWPFOptions options)
28 | {
29 | _options = options;
30 |
31 | if (_options.UpdateAccentFromWindows)
32 | {
33 | _accentColorService.UpdateAccentsColorsFromWindows();
34 | }
35 | else
36 | {
37 | _accentColorService.UpdateAccentsColors(_options.AccentColor);
38 | }
39 |
40 | _accentColorService.IsTitleBarAndBorderAccentAware = _options.IsTitleBarAndBorderAccentAware;
41 | }
42 |
43 | ///
44 | public WindowsAccentHelper WindowsAccentHelper => _accentColorService.WindowsAccentHelper;
45 |
46 | ///
47 | public IWeakEvent AccentColorChanged => _accentColorService.AccentColorChanged;
48 |
49 | ///
50 | public AccentColors AccentColors => _accentColorService.AccentColors;
51 |
52 | ///
53 | public bool AccentColorsUpdateFromWindows => _accentColorService.AccentColorsUpdateFromWindows;
54 |
55 | ///
56 | public bool IsTitleBarAndBorderAccentAware
57 | {
58 | get => _accentColorService.IsTitleBarAndBorderAccentAware;
59 | set => _accentColorService.IsTitleBarAndBorderAccentAware = value;
60 | }
61 |
62 | ///
63 | public bool IsTitleBarAndWindowsBorderColored => _accentColorService.IsTitleBarAndWindowsBorderColored;
64 |
65 | ///
66 | public void UpdateAccentsColors(Color systemAccent)
67 | {
68 | _accentColorService.UpdateAccentsColors(systemAccent);
69 | }
70 |
71 | ///
72 | public void UpdateAccentsColorsFromWindows()
73 | {
74 | _accentColorService.UpdateAccentsColorsFromWindows();
75 | }
76 |
77 | ///
78 | public void RefreshAccentsColors()
79 | {
80 | _accentColorService.RefreshAccentsColors();
81 | }
82 |
83 | ///
84 | public void IsTitleBarAndBorderAccentEnabled(Window window, bool isEnabled)
85 | {
86 | _accentColorService.IsTitleBarAndBorderAccentEnabled(window, isEnabled);
87 | }
88 | }
--------------------------------------------------------------------------------
/src/MicaWPF.DependencyInjection/Services/ThemeServiceDI.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using MicaWPF.Core.Enums;
7 | using MicaWPF.Core.Events;
8 | using MicaWPF.Core.Models;
9 | using MicaWPF.Core.Services;
10 | using MicaWPF.DependencyInjection.Options;
11 | using MicaWPF.Services;
12 |
13 | namespace MicaWPF.DependencyInjection.Services;
14 |
15 | ///
16 | /// The ThemeService through dependency injection.
17 | ///
18 | internal sealed class ThemeServiceDI : IThemeService
19 | {
20 | private readonly MicaWPFOptions _options;
21 | private readonly IThemeService _themeService = MicaWPFServiceUtility.ThemeService;
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | /// MicaWPF options.
27 | public ThemeServiceDI(MicaWPFOptions options)
28 | {
29 | _options = options;
30 | _ = _themeService.ChangeTheme(_options.Theme);
31 | }
32 |
33 | ///
34 | public IWeakEvent ThemeChanged => _themeService.ThemeChanged;
35 |
36 | ///
37 | public List BackdropEnabledWindows => _themeService.BackdropEnabledWindows;
38 |
39 | ///
40 | public WindowsTheme CurrentTheme => _themeService.CurrentTheme;
41 |
42 | ///
43 | public bool IsThemeAware => _themeService.IsThemeAware;
44 |
45 | ///
46 | public WindowsTheme ChangeTheme(WindowsTheme windowsTheme = WindowsTheme.Auto)
47 | {
48 | return _themeService.ChangeTheme(windowsTheme);
49 | }
50 |
51 | ///
52 | public void EnableBackdrop(Window window, BackdropType micaType = BackdropType.Mica)
53 | {
54 | _themeService.EnableBackdrop(window, micaType);
55 | }
56 |
57 | ///
58 | public void SetAccentColorService(IAccentColorService accentColorService)
59 | {
60 | _themeService.SetAccentColorService(accentColorService);
61 | }
62 | }
--------------------------------------------------------------------------------
/src/MicaWPF.Lite/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 |
7 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
--------------------------------------------------------------------------------
/src/MicaWPF.Lite/Controls/MicaWindow.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using MicaWPF.Core.Controls.MicaWindow;
6 |
7 | namespace MicaWPF.Lite.Controls;
8 |
9 | ///
10 | /// A window where custom backdrops are enabled.
11 | ///
12 | public class MicaWindow : MicaWindowBase
13 | {
14 | }
--------------------------------------------------------------------------------
/src/MicaWPF.Lite/MicaWPF.Lite.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net461;net47;net48;net481;netcoreapp3.1;net6.0-windows;net7.0-windows;net8.0-windows;net9.0-windows
5 | 7.0
6 | true
7 | Copyright (c) 2021 Simnico99
8 | https://github.com/Simnico99/MicaWPF
9 | git
10 | MicaWPF;WPF;Mica;WinUI;wpfui;UI;windows;controls;custom;modern;xaml;toolkit;color;dark;theme;Simnico99;net6;net5;net;fluent;acrylic
11 | True
12 | enable
13 | https://github.com/Simnico99/MicaWPF
14 | en
15 | latest
16 | enable
17 | MIT
18 | True
19 | MicaWPFLogo - 128x128.png
20 | Simnico99
21 | A WPF Library that implement an easy way to use Mica material without WinUI. This is the Lite version it doesn't contains most of the controls, etc...
22 | ReadmeNuget.md
23 | true
24 | true
25 | true
26 | snupkg
27 | true
28 | true
29 | NETSDK1138
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | \
39 | True
40 |
41 |
42 | True
43 | \
44 |
45 |
46 |
47 |
48 |
49 | all
50 | runtime; build; native; contentfiles; analyzers; buildtransitive
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/MicaWPF.Lite/Styles/ControlsDictionary.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Markup;
7 |
8 | namespace MicaWPF.Lite.Styles;
9 |
10 | [Localizability(LocalizationCategory.Ignore)]
11 | [Ambient]
12 | [UsableDuringInitialization(true)]
13 | public sealed class ControlsDictionary : ResourceDictionary
14 | {
15 | public ControlsDictionary()
16 | {
17 | Source = new($"pack://application:,,,/MicaWPF.Lite;component/Styles/MicaWPF.Lite.xaml", UriKind.Absolute);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/MicaWPF.Lite/Styles/MicaWPF.Lite.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/MicaWPF.Lite/Styles/ThemeDictionary.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using MicaWPF.Core.Styles;
6 |
7 | namespace MicaWPF.Lite.Styles;
8 |
9 | public sealed class ThemeDictionary : ThemeDictionaryBase
10 | {
11 | public override string SourceLocation { get; } = "pack://application:,,,/MicaWPF.Core;component/Styles/Themes";
12 | }
--------------------------------------------------------------------------------
/src/MicaWPF/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 |
7 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/AnimatedScrollBar.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Controls.Primitives;
7 | using System.Windows.Input;
8 | using MicaWPF.Core.Models;
9 |
10 | namespace MicaWPF.Controls;
11 |
12 | ///
13 | /// Is kinda of a smart .
14 | ///
15 | public class AnimatedScrollBar : ScrollBar
16 | {
17 | public static readonly DependencyProperty IsScrollingProperty = DependencyProperty.Register(nameof(IsScrolling), typeof(bool), typeof(AnimatedScrollBar), new PropertyMetadata(false, IsScrollingProperty_OnChange));
18 |
19 | public static readonly DependencyProperty IsInteractedProperty = DependencyProperty.Register(nameof(IsInteracted), typeof(bool), typeof(AnimatedScrollBar), new PropertyMetadata(false, IsInteractedProperty_OnChange));
20 |
21 | public static readonly DependencyProperty TimeoutProperty = DependencyProperty.Register(nameof(Timeout), typeof(int), typeof(AnimatedScrollBar), new PropertyMetadata(1000));
22 |
23 | private readonly EventIdentifier _interactiveIdentifier = new();
24 |
25 | private bool _isScrolling = false;
26 |
27 | private bool _isInteracted = false;
28 |
29 | ///
30 | /// Gets or sets a value indicating whether is currently scrolling.
31 | ///
32 | public bool IsScrolling
33 | {
34 | get => (bool)GetValue(IsScrollingProperty);
35 | set => SetValue(IsScrollingProperty, value);
36 | }
37 |
38 | ///
39 | /// Gets or sets a value indicating whether has been interacted with.
40 | ///
41 | public bool IsInteracted
42 | {
43 | get => (bool)GetValue(IsInteractedProperty);
44 | set
45 | {
46 | if ((bool)GetValue(IsInteractedProperty) != value)
47 | {
48 | SetValue(IsInteractedProperty, value);
49 | }
50 | }
51 | }
52 |
53 | ///
54 | /// Gets or sets has timed out.
55 | ///
56 | public int Timeout
57 | {
58 | get => (int)GetValue(TimeoutProperty);
59 | set => SetValue(TimeoutProperty, value);
60 | }
61 |
62 | protected override void OnMouseEnter(MouseEventArgs e)
63 | {
64 | base.OnMouseEnter(e);
65 |
66 | _ = UpdateScroll().GetAwaiter();
67 | }
68 |
69 | protected override void OnMouseLeave(MouseEventArgs e)
70 | {
71 | base.OnMouseLeave(e);
72 |
73 | _ = UpdateScroll().GetAwaiter();
74 | }
75 |
76 | private static void IsScrollingProperty_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
77 | {
78 | if (d is not AnimatedScrollBar bar)
79 | {
80 | return;
81 | }
82 |
83 | if (bar._isScrolling == bar.IsScrolling)
84 | {
85 | return;
86 | }
87 |
88 | bar._isScrolling = !bar._isScrolling;
89 |
90 | _ = bar.UpdateScroll().GetAwaiter();
91 | }
92 |
93 | private static void IsInteractedProperty_OnChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
94 | {
95 | if (d is not AnimatedScrollBar bar)
96 | {
97 | return;
98 | }
99 |
100 | if (bar._isInteracted == bar.IsInteracted)
101 | {
102 | return;
103 | }
104 |
105 | bar._isInteracted = !bar._isInteracted;
106 |
107 | _ = bar.UpdateScroll().GetAwaiter();
108 | }
109 |
110 | private async Task UpdateScroll()
111 | {
112 | var currentEvent = _interactiveIdentifier.GetNext();
113 | var shouldScroll = IsMouseOver || _isScrolling;
114 |
115 | if (shouldScroll == _isInteracted)
116 | {
117 | return;
118 | }
119 |
120 | if (!shouldScroll)
121 | {
122 | await Task.Delay(Timeout);
123 | }
124 |
125 | if (!_interactiveIdentifier.IsEqual(currentEvent))
126 | {
127 | return;
128 | }
129 |
130 | IsInteracted = shouldScroll;
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/Arc.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows;
7 | using System.Windows.Media;
8 | using System.Windows.Shapes;
9 |
10 | namespace MicaWPF.Controls;
11 |
12 | ///
13 | /// An arc used to make the .
14 | ///
15 | [ToolboxItem(false)]
16 | public class Arc : Shape
17 | {
18 | public static readonly DependencyProperty StartAngleProperty = DependencyProperty.Register(nameof(StartAngle), typeof(double), typeof(Arc), new PropertyMetadata(0.0d, PropertyChangedCallback));
19 |
20 | public static readonly DependencyProperty EndAngleProperty = DependencyProperty.Register(nameof(EndAngle), typeof(double), typeof(Arc), new PropertyMetadata(0.0d, PropertyChangedCallback));
21 |
22 | static Arc()
23 | {
24 | StrokeStartLineCapProperty.OverrideMetadata(typeof(Arc), new FrameworkPropertyMetadata(PenLineCap.Round));
25 | StrokeEndLineCapProperty.OverrideMetadata(typeof(Arc), new FrameworkPropertyMetadata(PenLineCap.Round));
26 | }
27 |
28 | ///
29 | /// Gets or sets the starting angle.
30 | ///
31 | public double StartAngle
32 | {
33 | get => (double)GetValue(StartAngleProperty);
34 | set => SetValue(StartAngleProperty, value);
35 | }
36 |
37 | ///
38 | /// Gets or sets the ending angle.
39 | ///
40 | public double EndAngle
41 | {
42 | get => (double)GetValue(EndAngleProperty);
43 | set => SetValue(EndAngleProperty, value);
44 | }
45 |
46 | ///
47 | /// Gets a value indicating whether is it a large arc.
48 | ///
49 | public bool IsLargeArc { get; internal set; } = false;
50 |
51 | protected override Geometry DefiningGeometry => GetDefiningGeometry();
52 |
53 | protected static void PropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
54 | {
55 | if (d is not Arc control)
56 | {
57 | return;
58 | }
59 |
60 | control.IsLargeArc = Math.Abs(control.EndAngle - control.StartAngle) > 180;
61 | control.InvalidateVisual();
62 | }
63 |
64 | protected Geometry GetDefiningGeometry()
65 | {
66 | var geometryStream = new StreamGeometry();
67 | var arcSize = new Size(Math.Max(0, (RenderSize.Width - StrokeThickness) / 2), Math.Max(0, (RenderSize.Height - StrokeThickness) / 2));
68 |
69 | using (var context = geometryStream.Open())
70 | {
71 | context.BeginFigure(PointAtAngle(Math.Min(StartAngle, EndAngle)), false, false);
72 | context.ArcTo(PointAtAngle(Math.Max(StartAngle, EndAngle)), arcSize, 0, IsLargeArc, SweepDirection.Counterclockwise, true, false);
73 | }
74 |
75 | geometryStream.Transform = new TranslateTransform(StrokeThickness / 2, StrokeThickness / 2);
76 |
77 | return geometryStream;
78 | }
79 |
80 | protected Point PointAtAngle(double angle)
81 | {
82 | var radAngle = angle * (Math.PI / 180);
83 | var xRadius = (RenderSize.Width - StrokeThickness) / 2;
84 | var yRadius = (RenderSize.Height - StrokeThickness) / 2;
85 |
86 | return new Point(xRadius + (xRadius * Math.Cos(radAngle)), yRadius - (yRadius * Math.Sin(radAngle)));
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/Button.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows;
7 | using MicaWPF.Core.Controls;
8 | using MicaWPF.Core.Symbols;
9 |
10 | namespace MicaWPF.Controls;
11 |
12 | ///
13 | /// A WinUI button based on .
14 | ///
15 | [ToolboxItem(true)]
16 | public class Button : System.Windows.Controls.Button, IButton
17 | {
18 | public static readonly DependencyProperty IconProperty = DependencyProperty.Register(nameof(Icon), typeof(FluentSystemIcons.Regular), typeof(Button), new PropertyMetadata(FluentSystemIcons.Regular.Empty));
19 | public static readonly DependencyProperty IconFilledProperty = DependencyProperty.Register(nameof(IconFilled), typeof(bool), typeof(Button), new PropertyMetadata(false));
20 | public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(Button));
21 |
22 | ///
23 | /// Gets or sets an icon to show in the button.
24 | ///
25 | public FluentSystemIcons.Regular Icon
26 | {
27 | get => (FluentSystemIcons.Regular)GetValue(IconProperty);
28 | set => SetValue(IconProperty, value);
29 | }
30 |
31 | ///
32 | /// Gets or sets a value indicating whether is the icon filled or not.
33 | ///
34 | public bool IconFilled
35 | {
36 | get => (bool)GetValue(IconFilledProperty);
37 | set => SetValue(IconFilledProperty, value);
38 | }
39 |
40 | ///
41 | /// Gets or sets the CornerRadius of the button.
42 | ///
43 | public CornerRadius CornerRadius
44 | {
45 | get => (CornerRadius)GetValue(CornerRadiusProperty);
46 | set => SetValue(CornerRadiusProperty, value);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/ColumnDefinitionExtended.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Controls;
7 |
8 | namespace MicaWPF.Controls;
9 |
10 | ///
11 | /// Extended ColumnDefinition.
12 | ///
13 | internal sealed class ColumnDefinitionExtended : ColumnDefinition
14 | {
15 | private static readonly DependencyProperty _visibleProperty;
16 |
17 | static ColumnDefinitionExtended()
18 | {
19 | _visibleProperty = DependencyProperty.Register("Visible", typeof(bool), typeof(ColumnDefinitionExtended), new PropertyMetadata(true, new PropertyChangedCallback(OnVisibleChanged)));
20 | WidthProperty.OverrideMetadata(typeof(ColumnDefinitionExtended), new FrameworkPropertyMetadata(new GridLength(1, GridUnitType.Star), null, new CoerceValueCallback(CoerceWidth)));
21 | MinWidthProperty.OverrideMetadata(typeof(ColumnDefinitionExtended), new FrameworkPropertyMetadata(0D, null, new CoerceValueCallback(CoerceMinWidth)));
22 | }
23 |
24 | ///
25 | /// Gets or sets a value indicating whether the column is visible.
26 | ///
27 | public bool Visible
28 | {
29 | get => (bool)GetValue(_visibleProperty);
30 | set => SetValue(_visibleProperty, value);
31 | }
32 |
33 | ///
34 | /// Sets the Visible property for a given DependencyObject.
35 | ///
36 | /// The DependencyObject whose property is set.
37 | /// The value to set.
38 | public static void SetVisible(DependencyObject obj, bool nVisible)
39 | {
40 | obj.SetValue(_visibleProperty, nVisible);
41 | }
42 |
43 | ///
44 | /// Gets the Visible property for a given DependencyObject.
45 | ///
46 | /// The DependencyObject whose property is retrieved.
47 | /// The value of the Visible property.
48 | public static bool GetVisible(DependencyObject obj)
49 | {
50 | return (bool)obj.GetValue(_visibleProperty);
51 | }
52 |
53 | private static void OnVisibleChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
54 | {
55 | obj.CoerceValue(WidthProperty);
56 | obj.CoerceValue(MinWidthProperty);
57 | }
58 |
59 | private static object CoerceWidth(DependencyObject obj, object nValue)
60 | {
61 | return ((ColumnDefinitionExtended)obj).Visible ? nValue : new GridLength(0);
62 | }
63 |
64 | private static object CoerceMinWidth(DependencyObject obj, object nValue)
65 | {
66 | return ((ColumnDefinitionExtended)obj).Visible ? nValue : 0D;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/Frame.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows;
7 | using MicaWPF.Core.Controls;
8 | using MicaWPF.Core.Extensions;
9 |
10 | namespace MicaWPF.Controls;
11 |
12 | ///
13 | /// A custom frame that reload styles on theme change.
14 | ///
15 | [ToolboxItem(true)]
16 | public class Frame : System.Windows.Controls.Frame
17 | {
18 | public Frame()
19 | {
20 | FocusVisualStyle = null;
21 | Focusable = false;
22 | }
23 |
24 | protected override void OnContentChanged(object oldContent, object newContent)
25 | {
26 | if (newContent is DependencyObject dependencyObject)
27 | {
28 | dependencyObject.RefreshChildrenStyle();
29 | }
30 |
31 | base.OnContentChanged(oldContent, newContent);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/MenuListViewItem.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Controls;
7 |
8 | namespace MicaWPF.Controls;
9 |
10 | public class MenuListViewItem : ListViewItem
11 | {
12 | public static readonly DependencyProperty ItemNameProperty = DependencyProperty.Register("ItemName", typeof(string), typeof(MenuListViewItem));
13 |
14 | public static readonly DependencyProperty IconLocationProperty = DependencyProperty.Register("IconLocation", typeof(string), typeof(MenuListViewItem));
15 |
16 | public string? ItemName
17 | {
18 | get => (string)GetValue(ItemNameProperty);
19 | set => SetValue(ItemNameProperty, value);
20 | }
21 |
22 | public string? IconLocation
23 | {
24 | get => (string)GetValue(IconLocationProperty);
25 | set => SetValue(IconLocationProperty, value);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/MicaWindow.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows.Markup;
6 | using MicaWPF.Core.Controls.MicaWindow;
7 |
8 | namespace MicaWPF.Controls;
9 |
10 | ///
11 | /// A window where custom backdrops are enabled.
12 | ///
13 | [UsableDuringInitialization(true)]
14 | public class MicaWindow : MicaWindowBase
15 | {
16 | }
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/RichSelectableLabel.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows.Controls;
7 |
8 | namespace MicaWPF.Controls;
9 |
10 | ///
11 | /// Label based on to allow it to be selectable, multilines and multiple colors.
12 | ///
13 | [ToolboxItem(true)]
14 | public class RichSelectableLabel : RichTextBox
15 | {
16 | }
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/SelectableLabel.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 |
7 | namespace MicaWPF.Controls;
8 |
9 | ///
10 | /// Label based on to allow it to be selectable.
11 | ///
12 | [ToolboxItem(true)]
13 | public class SelectableLabel : System.Windows.Controls.TextBox
14 | {
15 | }
16 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/SymbolIcon.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using MicaWPF.Core.Extensions;
9 | using MicaWPF.Core.Symbols;
10 |
11 | namespace MicaWPF.Controls;
12 |
13 | ///
14 | /// A .
15 | ///
16 | [ToolboxItem(true)]
17 | public class SymbolIcon : Label
18 | {
19 | public static readonly DependencyProperty SymbolProperty = DependencyProperty.Register(nameof(Symbol), typeof(FluentSystemIcons.Regular), typeof(SymbolIcon), new PropertyMetadata(FluentSystemIcons.Regular.Empty, OnGlyphChanged));
20 | public static readonly DependencyProperty RawSymbolProperty = DependencyProperty.Register(nameof(RawSymbol), typeof(string), typeof(SymbolIcon), new PropertyMetadata("\uEA01"));
21 | public static readonly DependencyProperty FilledProperty = DependencyProperty.Register(nameof(Filled), typeof(bool), typeof(SymbolIcon), new PropertyMetadata(false, OnGlyphChanged));
22 |
23 | ///
24 | /// Gets or sets the current Symbol.
25 | ///
26 | public FluentSystemIcons.Regular Symbol
27 | {
28 | get => (FluentSystemIcons.Regular)GetValue(SymbolProperty);
29 | set => SetValue(SymbolProperty, value);
30 | }
31 |
32 | ///
33 | /// Gets the current symbole as a .
34 | ///
35 | public string RawSymbol => (string)GetValue(RawSymbolProperty);
36 |
37 | ///
38 | /// Gets or sets a value indicating whether is it a filled icon or not.
39 | ///
40 | public bool Filled
41 | {
42 | get => (bool)GetValue(FilledProperty);
43 | set => SetValue(FilledProperty, value);
44 | }
45 |
46 | private static void OnGlyphChanged(DependencyObject dependency, DependencyPropertyChangedEventArgs eventArgs)
47 | {
48 | if (dependency is not SymbolIcon control)
49 | {
50 | return;
51 | }
52 |
53 | if ((bool)control.GetValue(FilledProperty))
54 | {
55 | control.SetValue(RawSymbolProperty, control.Symbol.Swap().GetString());
56 | }
57 | else
58 | {
59 | control.SetValue(RawSymbolProperty, control.Symbol.GetString());
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/TextBox.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows;
7 | using System.Windows.Media;
8 | using MicaWPF.Core.Enums;
9 | using MicaWPF.Core.Symbols;
10 |
11 | namespace MicaWPF.Controls;
12 |
13 | ///
14 | /// A WinUI TextBox based on .
15 | ///
16 | [ToolboxItem(true)]
17 | public class TextBox : System.Windows.Controls.TextBox
18 | {
19 | public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(string), typeof(TextBox));
20 | public static readonly DependencyProperty IconProperty = DependencyProperty.Register(nameof(Icon), typeof(FluentSystemIcons.Regular), typeof(System.Windows.Controls.TextBox), new PropertyMetadata(FluentSystemIcons.Regular.Empty));
21 | public static readonly DependencyProperty IconPositionProperty = DependencyProperty.Register(nameof(IconPosition), typeof(ElementPosition), typeof(TextBox), new PropertyMetadata(ElementPosition.Right));
22 | public static readonly DependencyProperty IconFilledProperty = DependencyProperty.Register(nameof(IconFilled), typeof(bool), typeof(TextBox), new PropertyMetadata(false));
23 | public static readonly DependencyProperty IconForegroundProperty = DependencyProperty.RegisterAttached(nameof(IconForeground), typeof(Brush), typeof(TextBox), new FrameworkPropertyMetadata(Brushes.Black, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.SubPropertiesDoNotAffectRender | FrameworkPropertyMetadataOptions.Inherits));
24 |
25 | ///
26 | /// Gets or sets the icon shown in the TextBox button.
27 | ///
28 | public FluentSystemIcons.Regular Icon
29 | {
30 | get => (FluentSystemIcons.Regular)GetValue(IconProperty);
31 | set => SetValue(IconProperty, value);
32 | }
33 |
34 | ///
35 | /// Gets or sets icon is on the right or left.
36 | ///
37 | public ElementPosition IconPosition
38 | {
39 | get => (ElementPosition)GetValue(IconPositionProperty);
40 | set => SetValue(IconPositionProperty, value);
41 | }
42 |
43 | ///
44 | /// Gets or sets a value indicating whether is the Icon filled or not.
45 | ///
46 | public bool IconFilled
47 | {
48 | get => (bool)GetValue(IconFilledProperty);
49 | set => SetValue(IconFilledProperty, value);
50 | }
51 |
52 | ///
53 | /// Gets or sets the foreground of the icon.
54 | ///
55 | public Brush IconForeground
56 | {
57 | get => (Brush)GetValue(IconForegroundProperty);
58 | set => SetValue(IconForegroundProperty, value);
59 | }
60 |
61 | ///
62 | /// Gets or sets a placeholder text for the TextBox.
63 | ///
64 | public string? Watermark
65 | {
66 | get => (string)GetValue(WatermarkProperty);
67 | set => SetValue(WatermarkProperty, value);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/MicaWPF/Controls/ToggleSwitch.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.ComponentModel;
6 | using System.Windows.Controls.Primitives;
7 |
8 | namespace MicaWPF.Controls;
9 |
10 | ///
11 | /// A toggle switch.
12 | ///
13 | [ToolboxItem(true)]
14 | public class ToggleSwitch : ToggleButton
15 | {
16 | }
17 |
--------------------------------------------------------------------------------
/src/MicaWPF/Dialogs/IContentDialog.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Media;
7 | using MicaWPF.Core.Enums;
8 |
9 | namespace MicaWPF.Dialogs;
10 |
11 | ///
12 | /// A WinUI like content dialog.
13 | ///
14 | public interface IContentDialog
15 | {
16 | ///
17 | /// Gets or sets the Style for the close button.
18 | ///
19 | Style CloseButtonStyle { get; set; }
20 |
21 | ///
22 | /// Gets or sets the Brush used for the inner border.
23 | ///
24 | Brush? InnerBorderBrush { get; set; }
25 |
26 | ///
27 | /// Gets or sets the content inside the dialog.
28 | ///
29 | object? InnerContent { get; set; }
30 |
31 | ///
32 | /// Gets or sets the text inside the dialog.
33 | ///
34 | string? InnerText { get; set; }
35 |
36 | ///
37 | /// Gets or sets the title text of the dialog.
38 | ///
39 | string? InnerTitleText { get; set; }
40 |
41 | ///
42 | /// Gets or sets the Style for the primary button.
43 | ///
44 | Style PrimaryButtonStyle { get; set; }
45 |
46 | ///
47 | /// Gets or sets the text for the primary button.
48 | ///
49 | string? PrimaryButtonText { get; set; }
50 |
51 | ///
52 | /// Gets the result of the content dialog.
53 | ///
54 | ContentDialogResult Result { get; }
55 |
56 | ///
57 | /// Gets or sets the Style for the secondary button.
58 | ///
59 | Style SecondaryButtonStyle { get; set; }
60 |
61 | ///
62 | /// Gets or sets the text for the secondary button.
63 | ///
64 | string? SecondaryButtonText { get; set; }
65 |
66 | ///
67 | /// Gets or sets the text for the tertiary button.
68 | ///
69 | string? TertiaryButtonText { get; set; }
70 |
71 | ///
72 | /// Initializes the component.
73 | ///
74 | void InitializeComponent();
75 |
76 | ///
77 | /// Shows the dialog asynchronously.
78 | ///
79 | /// A Task that represents the asynchronous operation.
80 | Task ShowAsync();
81 | }
--------------------------------------------------------------------------------
/src/MicaWPF/Fonts/FluentSystemIcons-Filled.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Simnico99/MicaWPF/eac144580274d06161c354442fa1c07784ae05e4/src/MicaWPF/Fonts/FluentSystemIcons-Filled.ttf
--------------------------------------------------------------------------------
/src/MicaWPF/Fonts/FluentSystemIcons-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Simnico99/MicaWPF/eac144580274d06161c354442fa1c07784ae05e4/src/MicaWPF/Fonts/FluentSystemIcons-Regular.ttf
--------------------------------------------------------------------------------
/src/MicaWPF/Fonts/SegUIVar.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Simnico99/MicaWPF/eac144580274d06161c354442fa1c07784ae05e4/src/MicaWPF/Fonts/SegUIVar.ttf
--------------------------------------------------------------------------------
/src/MicaWPF/Helpers/WinRTHelper.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows.Media;
6 | using MicaWPF.Core.Models;
7 | #if NET5_0_OR_GREATER
8 | using MicaWPFRuntimeComponent;
9 | #endif
10 | #if NETFRAMEWORK || NETCOREAPP3_1
11 | using Windows.UI.ViewManagement;
12 | #endif
13 |
14 | namespace MicaWPF.Helpers;
15 |
16 | public static class WinRTHelper
17 | {
18 | public static AccentColors GetSystemAccentColor()
19 | {
20 | #if NET5_0_OR_GREATER
21 | var tempColorAccent = default(Color);
22 | var tempColorAccentLight1 = default(Color);
23 | var tempColorAccentLight2 = default(Color);
24 | var tempColorAccentLight3 = default(Color);
25 | var tempColorAccentDark1 = default(Color);
26 | var tempColorAccentDark2 = default(Color);
27 | var tempColorAccentDark3 = default(Color);
28 |
29 | var uwpColors = new UWPColors();
30 | var colorsLongString = uwpColors.GetSystemColors();
31 |
32 | foreach (var colors in colorsLongString)
33 | {
34 | var colorValues = colors.Split(',');
35 | var colorResult = Color.FromArgb(byte.Parse(colorValues[0]), byte.Parse(colorValues[1]), byte.Parse(colorValues[2]), byte.Parse(colorValues[3]));
36 | switch (colorValues[4].ToString())
37 | {
38 | case "SystemAccentColor":
39 | tempColorAccent = colorResult;
40 | break;
41 | case "SystemAccentColorLight1":
42 | tempColorAccentLight1 = colorResult;
43 | break;
44 | case "SystemAccentColorLight2":
45 | tempColorAccentLight2 = colorResult;
46 | break;
47 | case "SystemAccentColorLight3":
48 | tempColorAccentLight3 = colorResult;
49 | break;
50 | case "SystemAccentColorDark1":
51 | tempColorAccentDark1 = colorResult;
52 | break;
53 | case "SystemAccentColorDark2":
54 | tempColorAccentDark2 = colorResult;
55 | break;
56 | case "SystemAccentColorDark3":
57 | tempColorAccentDark3 = colorResult;
58 | break;
59 | default:
60 | break;
61 | }
62 | }
63 |
64 | return new(
65 | tempColorAccent,
66 | tempColorAccentLight1,
67 | tempColorAccentLight2,
68 | tempColorAccentLight3,
69 | tempColorAccentDark1,
70 | tempColorAccentDark2,
71 | tempColorAccentDark3);
72 | #endif
73 | #if NETFRAMEWORK || NETCOREAPP3_1
74 | return new AccentColors(
75 | UIColorConverter(UIColorType.Accent),
76 | UIColorConverter(UIColorType.AccentLight1),
77 | UIColorConverter(UIColorType.AccentLight2),
78 | UIColorConverter(UIColorType.AccentLight3),
79 | UIColorConverter(UIColorType.AccentDark1),
80 | UIColorConverter(UIColorType.AccentDark2),
81 | UIColorConverter(UIColorType.AccentDark3));
82 | #endif
83 | }
84 |
85 | #if NETFRAMEWORK || NETCOREAPP3_1
86 | private static Color UIColorConverter(UIColorType colorType)
87 | {
88 | var uiSettings = new UISettings();
89 | var color = uiSettings.GetColorValue(colorType);
90 | return Color.FromArgb(color.A, color.R, color.G, color.B);
91 | }
92 | #endif
93 | }
94 |
--------------------------------------------------------------------------------
/src/MicaWPF/Helpers/WindowsAccentHelperWinRT.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using MicaWPF.Core.Helpers;
6 | using MicaWPF.Core.Interop;
7 | using MicaWPF.Core.Models;
8 | using Microsoft.Win32;
9 |
10 | namespace MicaWPF.Helpers;
11 |
12 | public sealed class WindowsAccentHelperWinRT : WindowsAccentHelper
13 | {
14 | public override bool AreTitleBarAndBordersAccented()
15 | {
16 | using var key = Registry.CurrentUser.OpenSubKey(_registryKeyPath);
17 | var registryValueObject = key?.GetValue(_registryValueName);
18 |
19 | if (registryValueObject == null)
20 | {
21 | return false;
22 | }
23 |
24 | var registryValue = (int)registryValueObject;
25 |
26 | return registryValue > 0;
27 | }
28 |
29 | public override AccentColors GetAccentColor()
30 | {
31 | try
32 | {
33 | var colors = WinRTHelper.GetSystemAccentColor();
34 |
35 | if (OsHelper.IsWindows11_OrGreater)
36 | {
37 | return colors;
38 | }
39 |
40 | return GetWindowsColorVariations(colors.SystemAccentColor);
41 | }
42 | catch
43 | {
44 | var colors = InteropMethods.GetDwmGetColorizationParameters();
45 | return GetWindowsColorVariations(ParseColor(colors.clrColor));
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/MicaWPF/ReadmeNuget.md:
--------------------------------------------------------------------------------
1 | https://github.com/Simnico99/MicaWPF
--------------------------------------------------------------------------------
/src/MicaWPF/Services/AccentColorServiceWinRT.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using MicaWPF.Core.Helpers;
6 | using MicaWPF.Core.Services;
7 | using MicaWPF.Helpers;
8 |
9 | namespace MicaWPF.Services;
10 |
11 | ///
12 | /// Service that manages the accent colors of the application.
13 | ///
2 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Small Light
3 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Small Semilight
4 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Small
5 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Small Semibold
6 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Small Bold
7 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Text Light
8 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Text Semilight
9 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Text
10 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Text Semibold
11 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Text Bold
12 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Display Light
13 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Display Semilight
14 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Display
15 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Display Semibold
16 | pack://application:,,,/MicaWPF;component/Fonts/#Segoe UI Variable Display Bold
17 | pack://application:,,,/MicaWPF;component/Fonts/#FluentSystemIcons-Regular
18 | pack://application:,,,/MicaWPF;component/Fonts/#FluentSystemIcons-Filled
19 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/AnimatedScrollViewer.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/ContextMenu.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/FocusVisualStyle.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/Label.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/ListView.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/ProgressBar.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/RichSelectableLabel.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/ScrollViewer.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/SelectableLabel.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/SymbolIcon.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 | pack://application:,,,/MicaWPF;component/Fonts/#FluentSystemIcons-Regular
7 |
8 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/Tooltip.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Controls/VisualStates/Common_Animations.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 | 00:00:00.250
7 | 00:00:00.167
8 | 00:00:00.168
9 | 00:00:00.083
10 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/ControlsDictionary.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Markup;
7 |
8 | namespace MicaWPF.Styles;
9 |
10 | [Ambient]
11 | [Localizability(LocalizationCategory.Ignore)]
12 | [UsableDuringInitialization(true)]
13 | public sealed class ControlsDictionary : ResourceDictionary
14 | {
15 | public ControlsDictionary()
16 | {
17 | Source = new($"pack://application:,,,/MicaWPF;component/Styles/MicaWPF.xaml", UriKind.Absolute);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/MicaWPF.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/ThemeDictionary.cs:
--------------------------------------------------------------------------------
1 | //
2 | // This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.
3 | //
4 |
5 | using System.Windows;
6 | using System.Windows.Markup;
7 | using MicaWPF.Core.Styles;
8 |
9 | namespace MicaWPF.Styles;
10 |
11 | [Ambient]
12 | [Localizability(LocalizationCategory.Ignore)]
13 | [UsableDuringInitialization(true)]
14 | public sealed class ThemeDictionary : ThemeDictionaryBase
15 | {
16 | public override string SourceLocation { get; } = "pack://application:,,,/MicaWPF;component/Styles/Themes";
17 | }
18 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Themes/MicaDark.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/MicaWPF/Styles/Themes/MicaLight.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/stylecop.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
3 | "settings": {
4 | "documentationRules": {
5 | "companyName": "Zircon Fusion",
6 | "copyrightText": "This software is distributed under the MIT license and its code is open-source and free for use, modification, and distribution.",
7 | "documentExposedElements": false
8 | },
9 | "orderingRules": {
10 | "usingDirectivesPlacement": "outsideNamespace"
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------