Rip out Microsoft's configuration and replace because it simply doesn't support polymorphism.... we are getting advanced boys!!!

This commit is contained in:
TheXamlGuy
2024-01-09 20:32:07 +00:00
parent e72d997563
commit 05b404d504
19 changed files with 247 additions and 135 deletions
@@ -3,6 +3,7 @@ using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Hyperbar.Windows.UI;
using Hyperbar.Windows.Interop;
using Windows.Foundation;
namespace Hyperbar.Windows.Controls;
@@ -37,8 +38,8 @@ internal class DesktopFlyoutHost : Window
{
return;
}
// presenter.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
presenter.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
double height = presenter.DesiredSize.Height;
double width = presenter.DesiredSize.Width;
@@ -12,7 +12,7 @@ public class DesktopFlyoutPresenter :
typeof(DesktopFlyoutPresenterTemplateSettings), typeof(DesktopFlyoutPresenter),
new PropertyMetadata(null));
internal new DesktopFlyout Parent;
internal new DesktopFlyout? Parent;
public DesktopFlyoutPresenter()
{
@@ -5,21 +5,22 @@
xmlns:controls="using:Hyperbar.Windows.Controls">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="CommandBarFlyoutBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<StaticResource x:Key="CommandBarFlyoutForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="CommandBarFlyoutBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
<StaticResource x:Key="DesktopFlyoutPresenterBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<StaticResource x:Key="DesktopFlyoutPresenterForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="DesktopFlyoutPresenterBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<StaticResource x:Key="CommandBarFlyoutBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<StaticResource x:Key="CommandBarFlyoutForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="CommandBarFlyoutBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
<StaticResource x:Key="DesktopFlyoutPresenterBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
<StaticResource x:Key="DesktopFlyoutPresenterForeground" ResourceKey="TextFillColorPrimaryBrush" />
<StaticResource x:Key="DesktopFlyoutPresenterBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<Thickness x:Key="DesktopFlyoutPresenterBorderThemeThickness">1</Thickness>
<Style TargetType="controls:DesktopFlyoutPresenter">
<Setter Property="Background" Value="{ThemeResource CommandBarFlyoutBackground}" />
<Setter Property="Foreground" Value="{ThemeResource CommandBarFlyoutForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource CommandBarFlyoutBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource CommandBarFlyoutBorderThemeThickness}" />
<Setter Property="Background" Value="{ThemeResource DesktopFlyoutPresenterBackground}" />
<Setter Property="Foreground" Value="{ThemeResource DesktopFlyoutPresenterForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource DesktopFlyoutPresenterBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource DesktopFlyoutPresenterBorderThemeThickness}" />
<Setter Property="CornerRadius" Value="{ThemeResource OverlayCornerRadius}" />
<Setter Property="Template">
<Setter.Value>
@@ -29,9 +30,9 @@
x:Name="BackgroundElement"
Height="48"
MinWidth="40"
Margin="24"
Margin="16"
Background="{TemplateBinding Background}"
BackgroundSizing="InnerBorderEdge"
BackgroundSizing="OuterBorderEdge"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
@@ -42,7 +43,8 @@
</TransitionCollection>
</Border.Transitions>
<ContentControl
Margin="{TemplateBinding Padding}"
Height="40"
Margin="4"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"