Move *everything* from setting flyout content and the flyout icons to a UWP control and simplified creation of the wpf host via a NotificationFlyoutApplication where you only need to set the UWP flyout

This commit is contained in:
Daniel Clark
2021-02-10 11:49:16 +00:00
parent 083c7b9365
commit b5b8641527
27 changed files with 315 additions and 166 deletions
@@ -11,11 +11,6 @@
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Icon-Light.ico" />
<None Remove="Assets\Icon.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Wpf.UI.XamlHost" Version="6.1.2" />
</ItemGroup>
@@ -26,10 +21,5 @@
<ProjectReference Include="..\..\src\NotificationFlyout.Wpf.UI\NotificationFlyout.Wpf.UI.csproj" />
<ProjectReference Include="..\NotificationFlyoutSample\NotificationFlyoutSample.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Icon-Light.ico" />
<Resource Include="Assets\Icon.ico" />
</ItemGroup>
</Project>
@@ -1,4 +1,5 @@
using System;
using NotificationFlyout.Wpf.UI.Controls;
using System;
namespace NotificationFlyoutSample.Host
{
@@ -10,7 +11,10 @@ namespace NotificationFlyoutSample.Host
using (new NotificationFlyoutSample.App())
{
var app = new App();
new SampleNotificationFlyout();
new NotificationFlyoutApplication
{
Flyout = new Shell()
};
app.Run();
}
}
@@ -1,9 +0,0 @@
<NotificationFlyout
x:Class="NotificationFlyoutSample.Host.SampleNotificationFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:uwp="clr-namespace:NotificationFlyoutSample;assembly=NotificationFlyoutSample"
IconSource="/Assets/Icon.ico"
LightIconSource="/Assets/Icon-Light.ico">
<uwp:Shell />
</NotificationFlyout>
@@ -1,10 +0,0 @@
namespace NotificationFlyoutSample.Host
{
public partial class SampleNotificationFlyout
{
public SampleNotificationFlyout()
{
InitializeComponent();
}
}
}

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

@@ -130,6 +130,8 @@
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Icon-Light.ico" />
<Content Include="Assets\Icon.ico" />
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
+22 -18
View File
@@ -1,21 +1,25 @@
<UserControl
<controls:NotificationFlyout
x:Class="NotificationFlyoutSample.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:winui="using:Microsoft.UI.Xaml.Controls">
<StackPanel
Width="330"
Height="500"
Margin="24">
<ComboBox x:Name="Theme" SelectionChanged="Theme_SelectionChanged">
<ComboBoxItem Content="Default" />
<ComboBoxItem Content="Dark" />
<ComboBoxItem Content="Light" />
</ComboBox>
<Button Margin="0,0,0,8" Content="Button" />
<Slider Margin="0,0,0,8" />
<TextBox Margin="0,0,0,8" />
<ToggleButton Margin="0,0,0,8" />
<CalendarView Margin="0,0,0,8" />
</StackPanel>
</UserControl>
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls"
xmlns:winui="using:Microsoft.UI.Xaml.Controls"
LightIconSource="/Assets/Icon.ico">
<controls:NotificationFlyout.Content>
<StackPanel
Width="330"
Height="500"
Margin="24">
<ComboBox x:Name="Theme" SelectionChanged="Theme_SelectionChanged">
<ComboBoxItem Content="Default" />
<ComboBoxItem Content="Dark" />
<ComboBoxItem Content="Light" />
</ComboBox>
<Button Margin="0,0,0,8" Content="Button" />
<Slider Margin="0,0,0,8" />
<TextBox Margin="0,0,0,8" />
<ToggleButton Margin="0,0,0,8" />
<CalendarView Margin="0,0,0,8" />
</StackPanel>
</controls:NotificationFlyout.Content>
</controls:NotificationFlyout>
+12 -12
View File
@@ -9,18 +9,18 @@
private void Theme_SelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
{
switch (Theme.SelectedIndex)
{
case 0:
RequestedTheme = Windows.UI.Xaml.ElementTheme.Default;
break;
case 1:
RequestedTheme = Windows.UI.Xaml.ElementTheme.Dark;
break;
case 2:
RequestedTheme = Windows.UI.Xaml.ElementTheme.Light;
break;
}
//switch (Theme.SelectedIndex)
//{
// case 0:
// RequestedTheme = Windows.UI.Xaml.ElementTheme.Default;
// break;
// case 1:
// RequestedTheme = Windows.UI.Xaml.ElementTheme.Dark;
// break;
// case 2:
// RequestedTheme = Windows.UI.Xaml.ElementTheme.Light;
// break;
//}
}
}
}