Rename projects to better structure it. The aim is to try and keep it not dependant on the type of UI framework it uses thus allowing us to switch to another UI framework if we need later...

This commit is contained in:
TheXamlGuy
2024-01-06 08:49:12 +00:00
parent b380f06fbf
commit 3e88950669
67 changed files with 211 additions and 196 deletions
@@ -0,0 +1,56 @@
using Microsoft.UI.Xaml;
namespace Hyperbar.Windows.Controls;
public class DesktopFlyout :
DependencyObject
{
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register(nameof(Content),
typeof(object), typeof(DesktopFlyout),
new PropertyMetadata(null));
public static readonly DependencyProperty PlacementProperty =
DependencyProperty.Register(nameof(Placement),
typeof(DesktopFlyoutPlacement), typeof(DesktopFlyout),
new PropertyMetadata(DesktopFlyoutPlacement.Left, OnPlacementPropertyChanged));
private readonly DesktopFlyoutHost host;
private readonly DesktopFlyoutPresenter presenter;
public DesktopFlyout()
{
presenter = new DesktopFlyoutPresenter
{
Parent = this
};
host = new DesktopFlyoutHost(presenter);
host.Activate();
}
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public DesktopFlyoutPlacement Placement
{
get => (DesktopFlyoutPlacement)GetValue(PlacementProperty);
set => SetValue(PlacementProperty, value);
}
private static void OnPlacementPropertyChanged(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs args)
{
if (dependencyObject is DesktopFlyout sender)
{
sender.OnPlacementPropertyChanged();
}
}
private void OnPlacementPropertyChanged() => UpdatePlacement();
private void UpdatePlacement() => host.UpdatePlacement(Placement);
}