More work

This commit is contained in:
TheXamlGuy
2024-02-04 14:08:38 +00:00
parent be3fe89387
commit 731cf3cdf3
34 changed files with 381 additions and 177 deletions
@@ -0,0 +1,56 @@
using Microsoft.UI.Xaml;
namespace Hyperbar.Controls.Windows;
public class DesktopApplicationBar :
DependencyObject
{
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register(nameof(Content),
typeof(object), typeof(DesktopApplicationBar),
new PropertyMetadata(null));
public static readonly DependencyProperty PlacementProperty =
DependencyProperty.Register(nameof(Placement),
typeof(DesktopApplicationBarPlacemenet), typeof(DesktopApplicationBar),
new PropertyMetadata(DesktopApplicationBarPlacemenet.Left, OnPlacementPropertyChanged));
private readonly DesktopApplicationBarHost host;
private readonly DesktopApplicationBarPresenter presenter;
public DesktopApplicationBar()
{
presenter = new DesktopApplicationBarPresenter
{
Parent = this
};
host = new DesktopApplicationBarHost(presenter);
host.Activate();
}
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public DesktopApplicationBarPlacemenet Placement
{
get => (DesktopApplicationBarPlacemenet)GetValue(PlacementProperty);
set => SetValue(PlacementProperty, value);
}
private static void OnPlacementPropertyChanged(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs args)
{
if (dependencyObject is DesktopApplicationBar sender)
{
sender.OnPlacementPropertyChanged();
}
}
private void OnPlacementPropertyChanged() => UpdatePlacement();
private void UpdatePlacement() => host.UpdatePlacement(Placement);
}