Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 46130da

Browse files
committed
Update Libs
1 parent e51c9b3 commit 46130da

File tree

13 files changed

+33
-203
lines changed

13 files changed

+33
-203
lines changed

dev/WinUIApp-MVVM-NavigationView/ViewModels/MainViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public MainViewModel(IJsonNavigationViewService jsonNavigationViewService, IThem
99
JsonNavigationViewService = jsonNavigationViewService;
1010
themeService.Initialize(App.CurrentWindow);
1111
themeService.ConfigBackdrop();
12-
themeService.ConfigElementTheme();$BackdropTintColorViewModel$
13-
themeService.ConfigBackdropFallBackColorForWindow10(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
12+
themeService.ConfigElementTheme();
13+
themeService.ConfigBackdropFallBackColorForUnSupportedOS(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
1414
}
1515

1616
public void OnAutoSuggestBoxTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)

dev/WinUIApp-MVVM-NavigationView/ViewModels/Settings/ThemeSettingViewModel.cs

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
using Microsoft.UI.Xaml.Media;
2-
using Windows.System;
1+
using Windows.System;
32

43
namespace $safeprojectname$.ViewModels;
54
public partial class ThemeSettingViewModel : ObservableObject
65
{
7-
[ObservableProperty]
8-
public Brush previewTintColor;
9-
106
public IThemeService ThemeService;
117
public ThemeSettingViewModel(IThemeService themeService)
128
{
139
ThemeService = themeService;
14-
PreviewTintColor = ThemeService.GetBackdropTintBrush();
1510
}
1611

1712
[RelayCommand]
@@ -26,32 +21,6 @@ private void OnThemeChanged(object sender)
2621
ThemeService.OnThemeComboBoxSelectionChanged(sender);
2722
}
2823

29-
[RelayCommand]
30-
private void OnColorPickerColorChanged(ColorChangedEventArgs args)
31-
{
32-
PreviewTintColor = new SolidColorBrush(args.NewColor);
33-
ThemeService.SetBackdropTintColor(args.NewColor);
34-
}
35-
36-
[RelayCommand]
37-
private void OnColorPaletteItemClick(ItemClickEventArgs e)
38-
{
39-
var color = e.ClickedItem as ColorPaletteItem;
40-
if (color != null)
41-
{
42-
if (color.Hex.Contains("#000000"))
43-
{
44-
ThemeService.ResetBackdropProperties();
45-
}
46-
else
47-
{
48-
ThemeService.SetBackdropTintColor(color.Color);
49-
}
50-
51-
PreviewTintColor = new SolidColorBrush(color.Color);
52-
}
53-
}
54-
5524
[RelayCommand]
5625
private async Task OpenWindowsColorSettings()
5726
{

dev/WinUIApp-MVVM-NavigationView/Views/Settings/ThemeSettingPage.xaml

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@
3535
</i:Interaction.Behaviors>
3636
</ComboBox>
3737
</wuc:SettingsCard>
38-
<wuc:SettingsExpander
38+
<wuc:SettingsCard
3939
Description="Change the appearance of the backdrop material behind your app. You can choose from mica, acrylic, or transparent options."
4040
Header="Material"
41-
HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/backdrop.png}"
42-
IsExpanded="True">
41+
HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/backdrop.png}">
4342
<ComboBox x:Name="CmbBackdrop">
4443
<ComboBoxItem Content="None" Tag="None" />
4544
<ComboBoxItem Content="Mica" Tag="Mica" />
@@ -56,67 +55,7 @@
5655
</ic:EventTriggerBehavior>
5756
</i:Interaction.Behaviors>
5857
</ComboBox>
59-
<wuc:SettingsExpander.ItemsHeader>
60-
<wuc:SettingsExpander
61-
Description="Make your experience more personalized by adjusting the color of the tint that overlays your backdrop material. You can choose from a variety of colors or use the color picker to select your own."
62-
Header="Pick your tint color"
63-
HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/tint.png}">
64-
<Button Padding="0">
65-
<StackPanel Orientation="Horizontal">
66-
<Border
67-
Width="24"
68-
Height="24"
69-
Margin="4"
70-
Background="Gray"
71-
CornerRadius="4">
72-
<Grid>
73-
<PathIcon Data="M0 6 L0 0 L6 0 L6 6 L12 6 L12 0 L18 0 L18 6 L12 6 L12 12 L18 12 L18 6 L24 6 L24 12 L18 12 L18 18 L24 18 L24 24 L6 24 L6 18 L0 18 L0 12 L6 12 L6 18 L12 18 L12 24 L18 24 L18 18 L12 18 L12 12 L6 12 L6 6 Z" Foreground="LightGray" />
74-
<Rectangle Fill="{x:Bind ViewModel.PreviewTintColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
75-
</Grid>
76-
</Border>
77-
<FontIcon
78-
Margin="8,4,10,4"
79-
FontSize="12"
80-
Glyph="&#xE70D;" />
81-
</StackPanel>
82-
<Button.Flyout>
83-
<Flyout>
84-
<ColorPicker IsAlphaEnabled="True" IsMoreButtonVisible="True">
85-
<i:Interaction.Behaviors>
86-
<ic:EventTriggerBehavior EventName="ColorChanged">
87-
<ic:EventTriggerBehavior.Actions>
88-
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ColorPickerColorChangedCommand}" />
89-
</ic:EventTriggerBehavior.Actions>
90-
</ic:EventTriggerBehavior>
91-
</i:Interaction.Behaviors>
92-
</ColorPicker>
93-
</Flyout>
94-
</Button.Flyout>
95-
</Button>
96-
<wuc:SettingsExpander.ItemsHeader>
97-
<wuc:SettingsCard>
98-
<wuc:SettingsCard.Description>
99-
<wuc:ColorPalette
100-
Margin="5,5,0,0"
101-
HorizontalAlignment="Left"
102-
ItemWidth="32"
103-
Palette="Rectangle"
104-
ShowHeader="False"
105-
Color="NormalLarge">
106-
<i:Interaction.Behaviors>
107-
<ic:EventTriggerBehavior EventName="ItemClick">
108-
<ic:EventTriggerBehavior.Actions>
109-
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ColorPaletteItemClickCommand}" />
110-
</ic:EventTriggerBehavior.Actions>
111-
</ic:EventTriggerBehavior>
112-
</i:Interaction.Behaviors>
113-
</wuc:ColorPalette>
114-
</wuc:SettingsCard.Description>
115-
</wuc:SettingsCard>
116-
</wuc:SettingsExpander.ItemsHeader>
117-
</wuc:SettingsExpander>
118-
</wuc:SettingsExpander.ItemsHeader>
119-
</wuc:SettingsExpander>
58+
</wuc:SettingsCard>
12059
<wuc:SettingsCard
12160
ActionIcon="{wuc:BitmapIcon Source=Assets/Fluent/external.png}"
12261
Command="{x:Bind ViewModel.OpenWindowsColorSettingsCommand}"

dev/WinUIApp-MVVM-NavigationView/WinUIApp-MVVM-NavigationView.vstemplate

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<Folder Name="Assets\Fluent" TargetFolderName="Assets\Fluent">
5454
<ProjectItem ReplaceParameters="false" TargetFileName="backdrop.png">backdrop.png</ProjectItem>
5555
<ProjectItem ReplaceParameters="false" TargetFileName="color.png">color.png</ProjectItem>
56-
<ProjectItem ReplaceParameters="false" TargetFileName="tint.png">tint.png</ProjectItem>
5756
<ProjectItem ReplaceParameters="false" TargetFileName="external.png">external.png</ProjectItem>
5857
<ProjectItem ReplaceParameters="false" TargetFileName="info.png">info.png</ProjectItem>
5958
<ProjectItem ReplaceParameters="false" TargetFileName="theme.png">theme.png</ProjectItem>

dev/WinUIApp-MVVM/ViewModels/MainViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public MainViewModel(IThemeService themeService)
88
themeService.Initialize(App.CurrentWindow);
99
themeService.ConfigBackdrop();
1010
themeService.ConfigElementTheme();
11-
themeService.ConfigBackdropFallBackColorForWindow10(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
11+
themeService.ConfigBackdropFallBackColorForUnSupportedOS(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
1212
}
1313

1414
public void OnAutoSuggestBoxTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)

dev/WinUIApp-NavigationView/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
3232
ThemeService = new ThemeService();
3333
ThemeService.Initialize(CurrentWindow);
3434
ThemeService.ConfigBackdrop();
35-
ThemeService.ConfigElementTheme();$BackdropTintColor$
36-
ThemeService.ConfigBackdropFallBackColorForWindow10(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
35+
ThemeService.ConfigElementTheme();
36+
ThemeService.ConfigBackdropFallBackColorForUnSupportedOS(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
3737

3838
rootFrame.Navigate(typeof(MainPage));
3939

dev/WinUIApp-NavigationView/Views/Settings/ThemeSettingPage.xaml

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:local="using:$safeprojectname$"
87
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
98
xmlns:views="using:$safeprojectname$.Views"
109
xmlns:wuc="using:WinUICommunity"
@@ -27,11 +26,10 @@
2726
<ComboBoxItem Content="Default" Tag="Default" />
2827
</ComboBox>
2928
</wuc:SettingsCard>
30-
<wuc:SettingsExpander
29+
<wuc:SettingsCard
3130
Description="Change the appearance of the backdrop material behind your app. You can choose from mica, acrylic, or transparent options."
3231
Header="Material"
33-
HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/backdrop.png}"
34-
IsExpanded="True">
32+
HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/backdrop.png}">
3533
<ComboBox x:Name="CmbBackdrop" SelectionChanged="CmbBackdrop_SelectionChanged">
3634
<ComboBoxItem Content="None" Tag="None" />
3735
<ComboBoxItem Content="Mica" Tag="Mica" />
@@ -41,56 +39,7 @@
4139
<ComboBoxItem Content="Acrylic Thin" Tag="AcrylicThin" />
4240
<ComboBoxItem Content="Transparent" Tag="Transparent" />
4341
</ComboBox>
44-
45-
<wuc:SettingsExpander.ItemsHeader>
46-
<wuc:SettingsExpander
47-
Description="Make your experience more personalized by adjusting the color of the tint that overlays your backdrop material. You can choose from a variety of colors or use the color picker to select your own."
48-
Header="Pick your tint color"
49-
HeaderIcon="{wuc:BitmapIcon Source=Assets/Fluent/tint.png}">
50-
<Button Padding="0">
51-
<StackPanel Orientation="Horizontal">
52-
<Border
53-
Width="24"
54-
Height="24"
55-
Margin="4"
56-
Background="Gray"
57-
CornerRadius="4">
58-
<Grid>
59-
<PathIcon Data="M0 6 L0 0 L6 0 L6 6 L12 6 L12 0 L18 0 L18 6 L12 6 L12 12 L18 12 L18 6 L24 6 L24 12 L18 12 L18 18 L24 18 L24 24 L6 24 L6 18 L0 18 L0 12 L6 12 L6 18 L12 18 L12 24 L18 24 L18 18 L12 18 L12 12 L6 12 L6 6 Z" Foreground="LightGray" />
60-
<Rectangle x:Name="TintBox" Fill="{x:Bind local:App.Current.ThemeService.GetBackdropTintBrush()}" />
61-
</Grid>
62-
</Border>
63-
<FontIcon
64-
Margin="8,4,10,4"
65-
FontSize="12"
66-
Glyph="&#xE70D;" />
67-
</StackPanel>
68-
<Button.Flyout>
69-
<Flyout>
70-
<ColorPicker
71-
ColorChanged="ColorPicker_ColorChanged"
72-
IsAlphaEnabled="True"
73-
IsMoreButtonVisible="True" />
74-
</Flyout>
75-
</Button.Flyout>
76-
</Button>
77-
<wuc:SettingsExpander.ItemsHeader>
78-
<wuc:SettingsCard>
79-
<wuc:SettingsCard.Description>
80-
<wuc:ColorPalette
81-
Margin="5,5,0,0"
82-
HorizontalAlignment="Left"
83-
ItemClick="ColorPalette_ItemClick"
84-
ItemWidth="32"
85-
Palette="Rectangle"
86-
ShowHeader="False"
87-
Color="NormalLarge" />
88-
</wuc:SettingsCard.Description>
89-
</wuc:SettingsCard>
90-
</wuc:SettingsExpander.ItemsHeader>
91-
</wuc:SettingsExpander>
92-
</wuc:SettingsExpander.ItemsHeader>
93-
</wuc:SettingsExpander>
42+
</wuc:SettingsCard>
9443
<wuc:SettingsCard
9544
ActionIcon="{wuc:BitmapIcon Source=Assets/Fluent/external.png}"
9645
Click="OpenWindowsColorSettings"

dev/WinUIApp-NavigationView/Views/Settings/ThemeSettingPage.xaml.cs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using Microsoft.UI.Xaml.Media;
2-
using Windows.System;
1+
using Windows.System;
32

43
namespace $safeprojectname$.Views;
54

@@ -35,30 +34,6 @@ private void CmbBackdrop_SelectionChanged(object sender, SelectionChangedEventAr
3534
App.Current.ThemeService.OnBackdropComboBoxSelectionChanged(sender);
3635
}
3736

38-
private void ColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args)
39-
{
40-
TintBox.Fill = new SolidColorBrush(args.NewColor);
41-
App.Current.ThemeService.SetBackdropTintColor(args.NewColor);
42-
}
43-
44-
private void ColorPalette_ItemClick(object sender, ItemClickEventArgs e)
45-
{
46-
var color = e.ClickedItem as ColorPaletteItem;
47-
if (color != null)
48-
{
49-
if (color.Hex.Contains("#000000"))
50-
{
51-
App.Current.ThemeService.ResetBackdropProperties();
52-
}
53-
else
54-
{
55-
App.Current.ThemeService.SetBackdropTintColor(color.Color);
56-
}
57-
58-
TintBox.Fill = new SolidColorBrush(color.Color);
59-
}
60-
}
61-
6237
private async void OpenWindowsColorSettings(object sender, RoutedEventArgs e)
6338
{
6439
_ = await Launcher.LaunchUriAsync(new Uri("ms-settings:colors"));

dev/WinUIApp-NavigationView/WinUIApp-NavigationView.vstemplate

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<Folder Name="Assets\Fluent" TargetFolderName="Assets\Fluent">
5454
<ProjectItem ReplaceParameters="false" TargetFileName="backdrop.png">backdrop.png</ProjectItem>
5555
<ProjectItem ReplaceParameters="false" TargetFileName="color.png">color.png</ProjectItem>
56-
<ProjectItem ReplaceParameters="false" TargetFileName="tint.png">tint.png</ProjectItem>
5756
<ProjectItem ReplaceParameters="false" TargetFileName="external.png">external.png</ProjectItem>
5857
<ProjectItem ReplaceParameters="false" TargetFileName="info.png">info.png</ProjectItem>
5958
<ProjectItem ReplaceParameters="false" TargetFileName="theme.png">theme.png</ProjectItem>

dev/WinUIApp/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
3131
ThemeService.Initialize(CurrentWindow);
3232
ThemeService.ConfigBackdrop();
3333
ThemeService.ConfigElementTheme();
34-
ThemeService.ConfigBackdropFallBackColorForWindow10(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
34+
ThemeService.ConfigBackdropFallBackColorForUnSupportedOS(Application.Current.Resources["ApplicationPageBackgroundThemeBrush"] as Brush);
3535

3636
rootFrame.Navigate(typeof(MainPage));
3737

0 commit comments

Comments
 (0)