Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the HorizontalIconAlignment property to the button. #1117

Closed
wants to merge 9 commits into from
72 changes: 9 additions & 63 deletions src/Wpf.Ui/Appearance/SystemThemeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,22 @@ private static SystemTheme GetCurrentSystemTheme()
{
var currentTheme =
Registry.GetValue(
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes",
@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes",
"CurrentTheme",
"aero.theme"
) as string
?? string.Empty;

var appUsesLightTheme = Registry.GetValue(
@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize",
"AppsUseLightTheme",
1
);

if (!string.IsNullOrEmpty(currentTheme))
{
currentTheme = currentTheme.ToLower().Trim();

// This may be changed in the next versions, check the Insider previews
if (currentTheme.Contains("basic.theme"))
{
return SystemTheme.Light;
}

if (currentTheme.Contains("aero.theme"))
{
return SystemTheme.Light;
}

if (currentTheme.Contains("dark.theme"))
{
return SystemTheme.Dark;
}

if (currentTheme.Contains("hcblack.theme"))
{
return SystemTheme.HCBlack;
Expand All @@ -106,52 +96,8 @@ private static SystemTheme GetCurrentSystemTheme()
{
return SystemTheme.HC2;
}

if (currentTheme.Contains("themea.theme"))
{
return SystemTheme.Glow;
}

if (currentTheme.Contains("themeb.theme"))
{
return SystemTheme.CapturedMotion;
}

if (currentTheme.Contains("themec.theme"))
{
return SystemTheme.Sunrise;
}

if (currentTheme.Contains("themed.theme"))
{
return SystemTheme.Flow;
}
}

/*if (currentTheme.Contains("custom.theme"))
return ; custom can be light or dark*/
var rawAppsUseLightTheme = Registry.GetValue(
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
"AppsUseLightTheme",
1
);

if (rawAppsUseLightTheme is 0)
{
return SystemTheme.Dark;
}
else if (rawAppsUseLightTheme is 1)
{
return SystemTheme.Light;
}

var rawSystemUsesLightTheme =
Registry.GetValue(
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
"SystemUsesLightTheme",
1
) ?? 1;

return rawSystemUsesLightTheme is 0 ? SystemTheme.Dark : SystemTheme.Light;
return appUsesLightTheme is 1 ? SystemTheme.Light : SystemTheme.Dark;
}
}
}
28 changes: 16 additions & 12 deletions src/Wpf.Ui/Controls/AccessText/AccessText.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
All Rights Reserved.
-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>

<Style x:Key="DefaultAccessTextStyle" TargetType="{x:Type AccessText}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Margin" Value="0" />
<Setter Property="Focusable" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Style x:Key="DefaultAccessTextStyle"
TargetType="{x:Type AccessText}"
>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
</Style>

<Style
x:Key="{x:Type AccessText}"
BasedOn="{StaticResource DefaultAccessTextStyle}"
TargetType="{x:Type AccessText}" />
<Style x:Key="{x:Type AccessText}"
BasedOn="{StaticResource DefaultAccessTextStyle}"
TargetType="{x:Type AccessText}"
/>

</ResourceDictionary>
22 changes: 12 additions & 10 deletions src/Wpf.Ui/Controls/Anchor/Anchor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@
Copyright (c) Microsoft Corporation. All Rights Reserved.
-->

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Controls">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Controls"
>

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Controls/Button/Button.xaml" />
<ResourceDictionary Source="pack://application:,,,/Wpf.Ui;component/Controls/Button/Button.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style
x:Key="DefaultUiAnchorStyle"
BasedOn="{StaticResource DefaultUiButtonStyle}"
TargetType="{x:Type controls:Anchor}" />
<Style x:Key="DefaultUiAnchorStyle"
BasedOn="{StaticResource DefaultUiButtonStyle}"
TargetType="{x:Type controls:Anchor}"
/>

<Style BasedOn="{StaticResource DefaultUiAnchorStyle}" TargetType="{x:Type controls:Anchor}" />
<Style BasedOn="{StaticResource DefaultUiAnchorStyle}"
TargetType="{x:Type controls:Anchor}"
/>

</ResourceDictionary>
Loading
Loading