More work
This commit is contained in:
+12
-12
@@ -2,30 +2,30 @@
|
|||||||
|
|
||||||
namespace Hyperbar.Controls.Windows;
|
namespace Hyperbar.Controls.Windows;
|
||||||
|
|
||||||
public class DesktopBar :
|
public class DesktopApplicationBar :
|
||||||
DependencyObject
|
DependencyObject
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty ContentProperty =
|
public static readonly DependencyProperty ContentProperty =
|
||||||
DependencyProperty.Register(nameof(Content),
|
DependencyProperty.Register(nameof(Content),
|
||||||
typeof(object), typeof(DesktopBar),
|
typeof(object), typeof(DesktopApplicationBar),
|
||||||
new PropertyMetadata(null));
|
new PropertyMetadata(null));
|
||||||
|
|
||||||
public static readonly DependencyProperty PlacementProperty =
|
public static readonly DependencyProperty PlacementProperty =
|
||||||
DependencyProperty.Register(nameof(Placement),
|
DependencyProperty.Register(nameof(Placement),
|
||||||
typeof(DesktopBarPlacemenet), typeof(DesktopBar),
|
typeof(DesktopApplicationBarPlacemenet), typeof(DesktopApplicationBar),
|
||||||
new PropertyMetadata(DesktopBarPlacemenet.Left, OnPlacementPropertyChanged));
|
new PropertyMetadata(DesktopApplicationBarPlacemenet.Left, OnPlacementPropertyChanged));
|
||||||
|
|
||||||
private readonly DesktopBarHost host;
|
private readonly DesktopApplicationBarHost host;
|
||||||
private readonly DesktopBarPresenter presenter;
|
private readonly DesktopApplicationBarPresenter presenter;
|
||||||
|
|
||||||
public DesktopBar()
|
public DesktopApplicationBar()
|
||||||
{
|
{
|
||||||
presenter = new DesktopBarPresenter
|
presenter = new DesktopApplicationBarPresenter
|
||||||
{
|
{
|
||||||
Parent = this
|
Parent = this
|
||||||
};
|
};
|
||||||
|
|
||||||
host = new DesktopBarHost(presenter);
|
host = new DesktopApplicationBarHost(presenter);
|
||||||
host.Activate();
|
host.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,16 +35,16 @@ public class DesktopBar :
|
|||||||
set => SetValue(ContentProperty, value);
|
set => SetValue(ContentProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DesktopBarPlacemenet Placement
|
public DesktopApplicationBarPlacemenet Placement
|
||||||
{
|
{
|
||||||
get => (DesktopBarPlacemenet)GetValue(PlacementProperty);
|
get => (DesktopApplicationBarPlacemenet)GetValue(PlacementProperty);
|
||||||
set => SetValue(PlacementProperty, value);
|
set => SetValue(PlacementProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnPlacementPropertyChanged(DependencyObject dependencyObject,
|
private static void OnPlacementPropertyChanged(DependencyObject dependencyObject,
|
||||||
DependencyPropertyChangedEventArgs args)
|
DependencyPropertyChangedEventArgs args)
|
||||||
{
|
{
|
||||||
if (dependencyObject is DesktopBar sender)
|
if (dependencyObject is DesktopApplicationBar sender)
|
||||||
{
|
{
|
||||||
sender.OnPlacementPropertyChanged();
|
sender.OnPlacementPropertyChanged();
|
||||||
}
|
}
|
||||||
+9
-9
@@ -6,13 +6,13 @@ using Hyperbar.UI.Windows;
|
|||||||
|
|
||||||
namespace Hyperbar.Controls.Windows;
|
namespace Hyperbar.Controls.Windows;
|
||||||
|
|
||||||
internal class DesktopBarHost : Window
|
internal class DesktopApplicationBarHost : Window
|
||||||
{
|
{
|
||||||
private readonly DesktopBarPresenter presenter;
|
private readonly DesktopApplicationBarPresenter presenter;
|
||||||
private readonly WindowSnapping windowSnapping;
|
private readonly WindowSnapping windowSnapping;
|
||||||
private DesktopBarPlacemenet placement;
|
private DesktopApplicationBarPlacemenet placement;
|
||||||
|
|
||||||
public DesktopBarHost(DesktopBarPresenter presenter)
|
public DesktopApplicationBarHost(DesktopApplicationBarPresenter presenter)
|
||||||
{
|
{
|
||||||
this.SetOpacity(0);
|
this.SetOpacity(0);
|
||||||
this.SetStyle(WindowStyle.SysMenu | WindowStyle.Visible);
|
this.SetStyle(WindowStyle.SysMenu | WindowStyle.Visible);
|
||||||
@@ -31,7 +31,7 @@ internal class DesktopBarHost : Window
|
|||||||
Closed += OnClosed;
|
Closed += OnClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void UpdatePlacement(DesktopBarPlacemenet placement)
|
internal void UpdatePlacement(DesktopApplicationBarPlacemenet placement)
|
||||||
{
|
{
|
||||||
this.placement = placement;
|
this.placement = placement;
|
||||||
UpdatePlacement();
|
UpdatePlacement();
|
||||||
@@ -44,19 +44,19 @@ internal class DesktopBarHost : Window
|
|||||||
|
|
||||||
switch (placement)
|
switch (placement)
|
||||||
{
|
{
|
||||||
case DesktopBarPlacemenet.Left:
|
case DesktopApplicationBarPlacemenet.Left:
|
||||||
windowSnapping.Snap(WindowSnappingPlacement.Left, (int)size);
|
windowSnapping.Snap(WindowSnappingPlacement.Left, (int)size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DesktopBarPlacemenet.Top:
|
case DesktopApplicationBarPlacemenet.Top:
|
||||||
windowSnapping.Snap(WindowSnappingPlacement.Top, (int)size);
|
windowSnapping.Snap(WindowSnappingPlacement.Top, (int)size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DesktopBarPlacemenet.Right:
|
case DesktopApplicationBarPlacemenet.Right:
|
||||||
windowSnapping.Snap(WindowSnappingPlacement.Right, (int)size);
|
windowSnapping.Snap(WindowSnappingPlacement.Right, (int)size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DesktopBarPlacemenet.Bottom:
|
case DesktopApplicationBarPlacemenet.Bottom:
|
||||||
windowSnapping.Snap(WindowSnappingPlacement.Bottom, (int)size);
|
windowSnapping.Snap(WindowSnappingPlacement.Bottom, (int)size);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
namespace Hyperbar.Controls.Windows;
|
namespace Hyperbar.Controls.Windows;
|
||||||
|
|
||||||
public enum DesktopBarPlacemenet
|
public enum DesktopApplicationBarPlacemenet
|
||||||
{
|
{
|
||||||
Left,
|
Left,
|
||||||
Top,
|
Top,
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
|
||||||
|
namespace Hyperbar.Controls.Windows;
|
||||||
|
|
||||||
|
public class DesktopApplicationBarPresenter :
|
||||||
|
ContentControl
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty TemplateSettingsProperty =
|
||||||
|
DependencyProperty.Register(nameof(TemplateSettings),
|
||||||
|
typeof(DesktopApplicationBarPresenterTemplateSettings), typeof(DesktopApplicationBarPresenter),
|
||||||
|
new PropertyMetadata(null));
|
||||||
|
|
||||||
|
internal new DesktopApplicationBar? Parent;
|
||||||
|
|
||||||
|
public DesktopApplicationBarPresenter()
|
||||||
|
{
|
||||||
|
DefaultStyleKey = typeof(DesktopApplicationBarPresenter);
|
||||||
|
TemplateSettings = new DesktopApplicationBarPresenterTemplateSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
SetBinding(ContentProperty, new Binding
|
||||||
|
{
|
||||||
|
Source = Parent,
|
||||||
|
Mode = BindingMode.TwoWay,
|
||||||
|
Path = new PropertyPath(nameof(Parent.Content)),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DesktopApplicationBarPresenterTemplateSettings TemplateSettings
|
||||||
|
{
|
||||||
|
get => (DesktopApplicationBarPresenterTemplateSettings)GetValue(TemplateSettingsProperty);
|
||||||
|
set => SetValue(TemplateSettingsProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void UpdatePlacementState(DesktopApplicationBarPlacemenet placement) => VisualStateManager.GoToState(this, $"{placement}Placement", true);
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="using:Hyperbar.Controls.Windows">
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Key="Default">
|
||||||
|
<StaticResource x:Key="DesktopApplicationBarPresenterBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
|
||||||
|
<StaticResource x:Key="DesktopApplicationBarPresenterForeground" ResourceKey="TextFillColorPrimaryBrush" />
|
||||||
|
<StaticResource x:Key="DesktopApplicationBarPresenterBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Key="Light">
|
||||||
|
<StaticResource x:Key="DesktopApplicationBarPresenterBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
|
||||||
|
<StaticResource x:Key="DesktopApplicationBarPresenterForeground" ResourceKey="TextFillColorPrimaryBrush" />
|
||||||
|
<StaticResource x:Key="DesktopApplicationBarPresenterBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
<Thickness x:Key="DesktopApplicationBarPresenterBorderThemeThickness">0</Thickness>
|
||||||
|
<Style TargetType="controls:DesktopApplicationBarPresenter">
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource DesktopApplicationBarPresenterForeground}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource DesktopApplicationBarPresenterBorderBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{ThemeResource DesktopApplicationBarPresenterBorderThemeThickness}" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="controls:DesktopApplicationBarPresenter">
|
||||||
|
<Border
|
||||||
|
MinHeight="48"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BackgroundSizing="OuterBorderEdge"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
|
FlowDirection="{TemplateBinding FlowDirection}">
|
||||||
|
<ContentControl
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
+5
-5
@@ -2,26 +2,26 @@
|
|||||||
|
|
||||||
namespace Hyperbar.Controls.Windows;
|
namespace Hyperbar.Controls.Windows;
|
||||||
|
|
||||||
public class DesktopBarPresenterTemplateSettings : DependencyObject
|
public class DesktopApplicationBarPresenterTemplateSettings : DependencyObject
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty HeightProperty =
|
public static readonly DependencyProperty HeightProperty =
|
||||||
DependencyProperty.Register(nameof(Height),
|
DependencyProperty.Register(nameof(Height),
|
||||||
typeof(double), typeof(DesktopBarPresenterTemplateSettings),
|
typeof(double), typeof(DesktopApplicationBarPresenterTemplateSettings),
|
||||||
new PropertyMetadata(0d));
|
new PropertyMetadata(0d));
|
||||||
|
|
||||||
public static readonly DependencyProperty NegativeHeightProperty =
|
public static readonly DependencyProperty NegativeHeightProperty =
|
||||||
DependencyProperty.Register(nameof(NegativeHeight),
|
DependencyProperty.Register(nameof(NegativeHeight),
|
||||||
typeof(double), typeof(DesktopBarPresenterTemplateSettings),
|
typeof(double), typeof(DesktopApplicationBarPresenterTemplateSettings),
|
||||||
new PropertyMetadata(0d));
|
new PropertyMetadata(0d));
|
||||||
|
|
||||||
public static readonly DependencyProperty NegativeWidthProperty =
|
public static readonly DependencyProperty NegativeWidthProperty =
|
||||||
DependencyProperty.Register(nameof(NegativeWidth),
|
DependencyProperty.Register(nameof(NegativeWidth),
|
||||||
typeof(double), typeof(DesktopBarPresenterTemplateSettings),
|
typeof(double), typeof(DesktopApplicationBarPresenterTemplateSettings),
|
||||||
new PropertyMetadata(0d));
|
new PropertyMetadata(0d));
|
||||||
|
|
||||||
public static readonly DependencyProperty WidthProperty =
|
public static readonly DependencyProperty WidthProperty =
|
||||||
DependencyProperty.Register(nameof(Width),
|
DependencyProperty.Register(nameof(Width),
|
||||||
typeof(double), typeof(DesktopBarPresenterTemplateSettings),
|
typeof(double), typeof(DesktopApplicationBarPresenterTemplateSettings),
|
||||||
new PropertyMetadata(0d));
|
new PropertyMetadata(0d));
|
||||||
|
|
||||||
public double Height
|
public double Height
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using Microsoft.UI.Xaml;
|
|
||||||
using Microsoft.UI.Xaml.Controls;
|
|
||||||
using Microsoft.UI.Xaml.Data;
|
|
||||||
|
|
||||||
namespace Hyperbar.Controls.Windows;
|
|
||||||
|
|
||||||
public class DesktopBarPresenter :
|
|
||||||
ContentControl
|
|
||||||
{
|
|
||||||
public static readonly DependencyProperty TemplateSettingsProperty =
|
|
||||||
DependencyProperty.Register(nameof(TemplateSettings),
|
|
||||||
typeof(DesktopBarPresenterTemplateSettings), typeof(DesktopBarPresenter),
|
|
||||||
new PropertyMetadata(null));
|
|
||||||
|
|
||||||
internal new DesktopBar? Parent;
|
|
||||||
|
|
||||||
public DesktopBarPresenter()
|
|
||||||
{
|
|
||||||
DefaultStyleKey = typeof(DesktopBarPresenter);
|
|
||||||
TemplateSettings = new DesktopBarPresenterTemplateSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnApplyTemplate()
|
|
||||||
{
|
|
||||||
SetBinding(ContentProperty, new Binding
|
|
||||||
{
|
|
||||||
Source = Parent,
|
|
||||||
Mode = BindingMode.TwoWay,
|
|
||||||
Path = new PropertyPath(nameof(Parent.Content)),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public DesktopBarPresenterTemplateSettings TemplateSettings
|
|
||||||
{
|
|
||||||
get => (DesktopBarPresenterTemplateSettings)GetValue(TemplateSettingsProperty);
|
|
||||||
set => SetValue(TemplateSettingsProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void UpdatePlacementState(DesktopBarPlacemenet placement) => VisualStateManager.GoToState(this, $"{placement}Placement", true);
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<ResourceDictionary
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:controls="using:Hyperbar.Controls.Windows">
|
|
||||||
<ResourceDictionary.ThemeDictionaries>
|
|
||||||
<ResourceDictionary x:Key="Default">
|
|
||||||
<StaticResource x:Key="DesktopBarPresenterBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
|
|
||||||
<StaticResource x:Key="DesktopBarPresenterForeground" ResourceKey="TextFillColorPrimaryBrush" />
|
|
||||||
<StaticResource x:Key="DesktopBarPresenterBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
|
|
||||||
</ResourceDictionary>
|
|
||||||
<ResourceDictionary x:Key="Light">
|
|
||||||
<StaticResource x:Key="DesktopBarPresenterBackground" ResourceKey="AcrylicInAppFillColorDefaultBrush" />
|
|
||||||
<StaticResource x:Key="DesktopBarPresenterForeground" ResourceKey="TextFillColorPrimaryBrush" />
|
|
||||||
<StaticResource x:Key="DesktopBarPresenterBorderBrush" ResourceKey="ControlStrokeColorDefaultBrush" />
|
|
||||||
</ResourceDictionary>
|
|
||||||
</ResourceDictionary.ThemeDictionaries>
|
|
||||||
<Thickness x:Key="DesktopBarPresenterBorderThemeThickness">0</Thickness>
|
|
||||||
<Style TargetType="controls:DesktopBarPresenter">
|
|
||||||
<Setter Property="Background" Value="Transparent" />
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource DesktopBarPresenterForeground}" />
|
|
||||||
<Setter Property="BorderBrush" Value="{ThemeResource DesktopBarPresenterBorderBrush}" />
|
|
||||||
<Setter Property="BorderThickness" Value="{ThemeResource DesktopBarPresenterBorderThemeThickness}" />
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="controls:DesktopBarPresenter">
|
|
||||||
<Border x:Name="Container" Background="Transparent">
|
|
||||||
<Border
|
|
||||||
x:Name="BackgroundElement"
|
|
||||||
MinWidth="48"
|
|
||||||
MinHeight="48"
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
BackgroundSizing="OuterBorderEdge"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
|
||||||
FlowDirection="{TemplateBinding FlowDirection}">
|
|
||||||
<ContentControl
|
|
||||||
Height="40"
|
|
||||||
Margin="4"
|
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
Content="{TemplateBinding Content}"
|
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
||||||
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
|
||||||
</Border>
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="PlacementStates">
|
|
||||||
<VisualState x:Name="DefaultPlacement" />
|
|
||||||
<VisualState x:Name="BottomPlacement" />
|
|
||||||
<VisualState x:Name="TopPlacement" />
|
|
||||||
<VisualState x:Name="LeftPlacement" />
|
|
||||||
<VisualState x:Name="RightPlacement" />
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="ms-appx:///Hyperbar.Controls.Windows/DesktopBar/DesktopBarPresenter.xaml" />
|
<ResourceDictionary Source="ms-appx:///Hyperbar.Controls.Windows/DesktopApplicationBar/DesktopApplicationBarPresenter.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
|
||||||
|
namespace Hyperbar.UI.Windows;
|
||||||
|
|
||||||
|
public class GridExtension
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty GridColumnBindingPathProperty =
|
||||||
|
DependencyProperty.RegisterAttached("GridColumnBindingPath",
|
||||||
|
typeof(string), typeof(GridExtension),
|
||||||
|
new PropertyMetadata(null, OnGridBindingPathPropertyChanged));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty GridRowBindingPathProperty =
|
||||||
|
DependencyProperty.RegisterAttached("GridRowBindingPath",
|
||||||
|
typeof(string), typeof(GridExtension),
|
||||||
|
new PropertyMetadata(null, OnGridBindingPathPropertyChanged));
|
||||||
|
|
||||||
|
public static string GetGridColumnBindingPath(DependencyObject dependencyObject) =>
|
||||||
|
(string)dependencyObject.GetValue(GridColumnBindingPathProperty);
|
||||||
|
|
||||||
|
public static string GetGridRowBindingPath(DependencyObject dependencyObject) =>
|
||||||
|
(string)dependencyObject.GetValue(GridRowBindingPathProperty);
|
||||||
|
|
||||||
|
public static void SetGridColumnBindingPath(DependencyObject dependencyObject, string value) =>
|
||||||
|
dependencyObject.SetValue(GridColumnBindingPathProperty, value);
|
||||||
|
public static void SetGridRowBindingPath(DependencyObject dependencyObject, string value) =>
|
||||||
|
dependencyObject.SetValue(GridRowBindingPathProperty, value);
|
||||||
|
|
||||||
|
private static void OnGridBindingPathPropertyChanged(DependencyObject dependencyObject,
|
||||||
|
DependencyPropertyChangedEventArgs args)
|
||||||
|
{
|
||||||
|
if (args.NewValue is string propertyPath)
|
||||||
|
{
|
||||||
|
DependencyProperty gridProperty =
|
||||||
|
args.Property == GridColumnBindingPathProperty
|
||||||
|
? Grid.ColumnProperty
|
||||||
|
: Grid.RowProperty;
|
||||||
|
|
||||||
|
BindingOperations.SetBinding(
|
||||||
|
dependencyObject,
|
||||||
|
gridProperty,
|
||||||
|
new Binding { Path = new PropertyPath(propertyPath) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,12 +11,10 @@ public class TemplateGenerator : DataTemplateSelector
|
|||||||
string xamlString = @"
|
string xamlString = @"
|
||||||
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
|
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
|
||||||
xmlns:ui=""using:Hyperbar.UI.Windows"">
|
xmlns:ui=""using:Hyperbar.UI.Windows"">
|
||||||
<Grid>
|
|
||||||
<ui:TemplateGeneratorControl VerticalContentAlignment=""Stretch""
|
<ui:TemplateGeneratorControl VerticalContentAlignment=""Stretch""
|
||||||
HorizontalContentAlignment=""Stretch""
|
HorizontalContentAlignment=""Stretch""
|
||||||
HorizontalAlignment=""Stretch""
|
HorizontalAlignment=""Stretch""
|
||||||
VerticalAlignment=""Stretch""/>
|
VerticalAlignment=""Stretch""/>
|
||||||
</Grid>
|
|
||||||
</DataTemplate>";
|
</DataTemplate>";
|
||||||
|
|
||||||
return (DataTemplate)XamlReader.Load(xamlString);
|
return (DataTemplate)XamlReader.Load(xamlString);
|
||||||
@@ -27,12 +25,10 @@ public class TemplateGenerator : DataTemplateSelector
|
|||||||
string xamlString = @"
|
string xamlString = @"
|
||||||
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
|
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
|
||||||
xmlns:ui=""using:Hyperbar.UI.Windows"">
|
xmlns:ui=""using:Hyperbar.UI.Windows"">
|
||||||
<Grid>
|
|
||||||
<ui:TemplateGeneratorControl VerticalContentAlignment=""Stretch""
|
<ui:TemplateGeneratorControl VerticalContentAlignment=""Stretch""
|
||||||
HorizontalContentAlignment=""Stretch""
|
HorizontalContentAlignment=""Stretch""
|
||||||
HorizontalAlignment=""Stretch""
|
HorizontalAlignment=""Stretch""
|
||||||
VerticalAlignment=""Stretch""/>
|
VerticalAlignment=""Stretch""/>
|
||||||
</Grid>
|
|
||||||
</DataTemplate>";
|
</DataTemplate>";
|
||||||
|
|
||||||
return (DataTemplate)XamlReader.Load(xamlString);
|
return (DataTemplate)XamlReader.Load(xamlString);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ public class TemplateGeneratorControl :
|
|||||||
DataContextChanged += OnDataContextChanged;
|
DataContextChanged += OnDataContextChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
|
private void OnDataContextChanged(FrameworkElement sender,
|
||||||
|
DataContextChangedEventArgs args)
|
||||||
{
|
{
|
||||||
if (DataContext is ITemplatedViewModel templatedViewModel)
|
if (DataContext is ITemplatedViewModel templatedViewModel)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ public static class IServiceCollectionExtensions
|
|||||||
{
|
{
|
||||||
public static IServiceCollection AddWidgetWindows(this IServiceCollection services)
|
public static IServiceCollection AddWidgetWindows(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddContentTemplate<WidgetViewModel, WidgetBarView>();
|
|
||||||
|
|
||||||
// We need to feed information to the Widgets about our Windows host,
|
// We need to feed information to the Widgets about our Windows host,
|
||||||
// so the Windows host can make discussions how to display and interact with the widgets.
|
// so the Windows host can make discussions how to display and interact with the widgets.
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
using Microsoft.UI.Xaml.Controls;
|
|
||||||
|
|
||||||
namespace Hyperbar.Widget.Windows;
|
|
||||||
|
|
||||||
public sealed partial class WidgetBarView :
|
|
||||||
UserControl
|
|
||||||
{
|
|
||||||
public WidgetBarView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
namespace Hyperbar.Widget;
|
||||||
|
|
||||||
|
public interface IWidgetHostViewModel;
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace Hyperbar.Widget;
|
|
||||||
|
|
||||||
[NotificationHandler(nameof(WidgetViewModel))]
|
|
||||||
public partial class WidgetViewModel(ITemplateFactory templateFactory,
|
|
||||||
IServiceFactory serviceFactory,
|
|
||||||
IMediator mediator,
|
|
||||||
IDisposer disposer) :
|
|
||||||
ObservableCollectionViewModel<IWidgetViewModel>(serviceFactory, mediator, disposer),
|
|
||||||
ITemplatedViewModel
|
|
||||||
{
|
|
||||||
public ITemplateFactory TemplateFactory => templateFactory;
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,7 @@ public class WidgetStartedHandler(IMediator mediator) :
|
|||||||
if (host.Services.GetService<IWidgetViewModel>() is IWidgetViewModel viewModel)
|
if (host.Services.GetService<IWidgetViewModel>() is IWidgetViewModel viewModel)
|
||||||
{
|
{
|
||||||
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
|
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
|
||||||
nameof(WidgetViewModel), cancellationToken);
|
nameof(IWidgetHostViewModel), cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class WidgetViewModelEnumerator(IWidgetHost host,
|
|||||||
foreach (IWidgetViewModel viewModel in viewModels)
|
foreach (IWidgetViewModel viewModel in viewModels)
|
||||||
{
|
{
|
||||||
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
|
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
|
||||||
nameof(WidgetViewModel), cancellationToken);
|
nameof(IWidgetHostViewModel), cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,11 +43,15 @@ public partial class App :
|
|||||||
services.AddHandler<AppConfigurationChangedHandler>();
|
services.AddHandler<AppConfigurationChangedHandler>();
|
||||||
services.AddConfiguration<AppConfiguration>(args =>
|
services.AddConfiguration<AppConfiguration>(args =>
|
||||||
{
|
{
|
||||||
args.Placement = DesktopBarPlacemenet.Top;
|
args.Placement = DesktopApplicationBarPlacemenet.Top;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddSingleton<DesktopApplicationBar>();
|
||||||
|
services.AddContentTemplate<ApplicationBarViewModel, ApplicationBarView>();
|
||||||
|
services.AddContentTemplate<PrimaryViewModel, PrimaryView>();
|
||||||
|
services.AddContentTemplate<SecondaryViewModel, SecondaryView>();
|
||||||
|
|
||||||
services.AddTransient<IInitializer, AppInitializer>();
|
services.AddTransient<IInitializer, AppInitializer>();
|
||||||
services.AddSingleton<DesktopBar>();
|
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,5 +4,5 @@ namespace Hyperbar.Windows;
|
|||||||
|
|
||||||
public class AppConfiguration
|
public class AppConfiguration
|
||||||
{
|
{
|
||||||
public DesktopBarPlacemenet Placement { get; set; }
|
public DesktopApplicationBarPlacemenet Placement { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
using Hyperbar.Controls.Windows;
|
using Hyperbar.Controls.Windows;
|
||||||
using Hyperbar.Widget;
|
using Hyperbar.Widget;
|
||||||
using Hyperbar.Widget.Windows;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Windows;
|
||||||
|
|
||||||
public class AppInitializer([FromKeyedServices(nameof(WidgetViewModel))] WidgetBarView view,
|
public class AppInitializer([FromKeyedServices(nameof(ApplicationBarViewModel))] ApplicationBarView view,
|
||||||
[FromKeyedServices(nameof(WidgetViewModel))] WidgetViewModel viewModel,
|
[FromKeyedServices(nameof(ApplicationBarViewModel))] ApplicationBarViewModel viewModel,
|
||||||
DesktopBar desktopFlyout,
|
DesktopApplicationBar desktopFlyout,
|
||||||
AppConfiguration configuration) :
|
AppConfiguration configuration) :
|
||||||
IInitializer
|
IInitializer
|
||||||
{
|
{
|
||||||
+12
-2
@@ -1,13 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Hyperbar.Widget.Windows.WidgetBarView"
|
x:Class="Hyperbar.Windows.ApplicationBarView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:windows="using:Hyperbar.UI.Windows">
|
xmlns:windows="using:Hyperbar.UI.Windows">
|
||||||
<ItemsControl ItemTemplateSelector="{Binding Converter={windows:DataTemplateConverter}}" ItemsSource="{Binding}">
|
<ItemsControl ItemTemplateSelector="{Binding Converter={windows:DataTemplateConverter}}" ItemsSource="{Binding}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Orientation="Horizontal" />
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="400" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
</Grid>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.ItemContainerTransitions>
|
<ItemsControl.ItemContainerTransitions>
|
||||||
@@ -15,5 +20,10 @@
|
|||||||
<AddDeleteThemeTransition />
|
<AddDeleteThemeTransition />
|
||||||
</TransitionCollection>
|
</TransitionCollection>
|
||||||
</ItemsControl.ItemContainerTransitions>
|
</ItemsControl.ItemContainerTransitions>
|
||||||
|
<ItemsControl.ItemContainerStyle>
|
||||||
|
<Style TargetType="ContentPresenter">
|
||||||
|
<Setter Property="windows:GridExtension.GridColumnBindingPath" Value="Index" />
|
||||||
|
</Style>
|
||||||
|
</ItemsControl.ItemContainerStyle>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Hyperbar.Windows;
|
||||||
|
|
||||||
|
public sealed partial class ApplicationBarView :
|
||||||
|
UserControl
|
||||||
|
{
|
||||||
|
public ApplicationBarView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace Hyperbar.Widget;
|
||||||
|
|
||||||
|
[NotificationHandler(nameof(IWidgetHostViewModel))]
|
||||||
|
public partial class ApplicationBarViewModel :
|
||||||
|
ObservableCollectionViewModel<IDisposable>,
|
||||||
|
ITemplatedViewModel
|
||||||
|
{
|
||||||
|
public ApplicationBarViewModel(ITemplateFactory templateFactory,
|
||||||
|
IServiceFactory serviceFactory,
|
||||||
|
IMediator mediator,
|
||||||
|
IDisposer disposer) : base(serviceFactory, mediator, disposer)
|
||||||
|
{
|
||||||
|
TemplateFactory = templateFactory;
|
||||||
|
|
||||||
|
Add<PrimaryViewModel>(0);
|
||||||
|
Add<SecondaryViewModel>(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITemplateFactory TemplateFactory { get; }
|
||||||
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Hyperbar.Windows;
|
namespace Hyperbar.Windows;
|
||||||
|
|
||||||
public class AppConfigurationChangedHandler(DesktopBar desktopFlyout,
|
public class AppConfigurationChangedHandler(DesktopApplicationBar desktopFlyout,
|
||||||
AppConfiguration configuration) :
|
AppConfiguration configuration) :
|
||||||
INotificationHandler<Changed<AppConfiguration>>
|
INotificationHandler<Changed<AppConfiguration>>
|
||||||
{
|
{
|
||||||
@@ -13,6 +13,11 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseRidGraph>true</UseRidGraph>
|
<UseRidGraph>true</UseRidGraph>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="ApplicationBarView.xaml" />
|
||||||
|
<None Remove="PrimaryView.xaml" />
|
||||||
|
<None Remove="SecondaryView.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||||
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||||
@@ -48,4 +53,20 @@
|
|||||||
<ProjectReference Include="..\Hyperbar.Widget\Hyperbar.Widget.csproj" />
|
<ProjectReference Include="..\Hyperbar.Widget\Hyperbar.Widget.csproj" />
|
||||||
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
<ProjectReference Include="..\Hyperbar\Hyperbar.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Update="SecondaryView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Update="PrimaryView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Update="ApplicationBarView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<UserControl
|
||||||
|
x:Class="Hyperbar.Windows.PrimaryView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:windows="using:Hyperbar.UI.Windows">
|
||||||
|
<ItemsControl
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
ItemTemplateSelector="{Binding Converter={windows:DataTemplateConverter}}"
|
||||||
|
ItemsSource="{Binding}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<ItemsStackPanel Orientation="Horizontal" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
</ItemsControl>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
using Microsoft.UI.Xaml.Input;
|
||||||
|
using Microsoft.UI.Xaml.Media;
|
||||||
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
|
||||||
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
|
||||||
|
namespace Hyperbar.Windows
|
||||||
|
{
|
||||||
|
public sealed partial class PrimaryView : UserControl
|
||||||
|
{
|
||||||
|
public PrimaryView()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Hyperbar.Widget;
|
||||||
|
|
||||||
|
[NotificationHandler(nameof(IWidgetHostViewModel))]
|
||||||
|
public partial class PrimaryViewModel(ITemplateFactory templateFactory,
|
||||||
|
IServiceFactory serviceFactory,
|
||||||
|
IMediator mediator,
|
||||||
|
IDisposer disposer,
|
||||||
|
int index) :
|
||||||
|
ObservableCollectionViewModel<IWidgetViewModel>(serviceFactory, mediator, disposer),
|
||||||
|
IWidgetHostViewModel,
|
||||||
|
ITemplatedViewModel
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int index = index;
|
||||||
|
|
||||||
|
public ITemplateFactory TemplateFactory => templateFactory;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<UserControl
|
||||||
|
x:Class="Hyperbar.Windows.SecondaryView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:windows="using:Hyperbar.UI.Windows">
|
||||||
|
<ItemsControl
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
ItemTemplateSelector="{Binding Converter={windows:DataTemplateConverter}}"
|
||||||
|
ItemsSource="{Binding}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<ItemsStackPanel Orientation="Horizontal" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
</ItemsControl>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||||
|
using Microsoft.UI.Xaml.Data;
|
||||||
|
using Microsoft.UI.Xaml.Input;
|
||||||
|
using Microsoft.UI.Xaml.Media;
|
||||||
|
using Microsoft.UI.Xaml.Navigation;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices.WindowsRuntime;
|
||||||
|
using Windows.Foundation;
|
||||||
|
using Windows.Foundation.Collections;
|
||||||
|
|
||||||
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
|
||||||
|
namespace Hyperbar.Windows
|
||||||
|
{
|
||||||
|
public sealed partial class SecondaryView : UserControl
|
||||||
|
{
|
||||||
|
public SecondaryView()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace Hyperbar.Widget;
|
||||||
|
|
||||||
|
public partial class SecondaryViewModel(ITemplateFactory templateFactory,
|
||||||
|
IServiceFactory serviceFactory,
|
||||||
|
IMediator mediator,
|
||||||
|
IDisposer disposer,
|
||||||
|
int index) :
|
||||||
|
ObservableCollectionViewModel<IDisposable>(serviceFactory, mediator, disposer),
|
||||||
|
ITemplatedViewModel
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int index = index;
|
||||||
|
|
||||||
|
public ITemplateFactory TemplateFactory => templateFactory;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user