[WIP] Add context menu support

This commit is contained in:
Daniel Clark
2021-02-10 22:44:19 +00:00
parent 72983bef6a
commit 91b4f94e3f
29 changed files with 391 additions and 107 deletions
@@ -20,6 +20,7 @@
<ProjectReference Include="..\..\src\NotificationFlyout.Uwp.UI.Controls\NotificationFlyout.Uwp.UI.Controls.csproj" />
<ProjectReference Include="..\..\src\NotificationFlyout.Wpf.UI.Controls\NotificationFlyout.Wpf.UI.Controls.csproj" />
<ProjectReference Include="..\..\src\NotificationFlyout.Wpf.UI\NotificationFlyout.Wpf.UI.csproj" />
<ProjectReference Include="..\NotificationFlyout.Shared.UI\NotificationFlyout.Shared.UI.csproj" />
<ProjectReference Include="..\NotificationFlyoutSample\NotificationFlyoutSample.csproj" />
</ItemGroup>
+22
View File
@@ -22,6 +22,8 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "NotificationFlyoutSample.Pa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Uwp.UI", "..\src\NotificationFlyout.Uwp.UI\NotificationFlyout.Uwp.UI.csproj", "{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyout.Shared.UI", "NotificationFlyout.Shared.UI\NotificationFlyout.Shared.UI.csproj", "{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -193,6 +195,26 @@ Global
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x64.Build.0 = Release|x64
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x86.ActiveCfg = Release|Any CPU
{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Release|x86.Build.0 = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|ARM.Build.0 = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|ARM64.Build.0 = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|x64.ActiveCfg = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|x64.Build.0 = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Debug|x86.Build.0 = Debug|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|Any CPU.Build.0 = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|ARM.ActiveCfg = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|ARM.Build.0 = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|ARM64.ActiveCfg = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|ARM64.Build.0 = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|x64.ActiveCfg = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|x64.Build.0 = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|x86.ActiveCfg = Release|Any CPU
{6D11191A-6A61-4A93-BEBB-EC34FE9FA403}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -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();
}
}
}
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30914.41
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyoutSample.Host", "NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj", "{D13742AD-DB71-4269-B3AF-7CA8C4E51A19}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyoutSample.Host", "NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj", "{D13742AD-DB71-4269-B3AF-7CA8C4E51A19}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyoutSample", "NotificationFlyoutSample\NotificationFlyoutSample.csproj", "{2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}"
EndProject
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

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" />
@@ -1,16 +1,83 @@
<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">
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
IconSource="/Assets/Icon.ico"
LightIconSource="/Assets/Icon-Light.ico">
<StackPanel Margin="24">
<ComboBox
x:Name="Theme"
Margin="0,0,0,8"
SelectionChanged="Theme_SelectionChanged">
<ComboBoxItem Content="Default" />
<ComboBoxItem Content="Dark" />
<ComboBoxItem Content="Light" />
</ComboBox>
<muxc:MenuBar>
<muxc:MenuBarItem Title="File">
<MenuFlyoutItem Text="New" />
<MenuFlyoutItem Text="Open..." />
<MenuFlyoutItem Text="Save" />
<MenuFlyoutItem Text="Exit" />
</muxc:MenuBarItem>
<muxc:MenuBarItem Title="Edit">
<MenuFlyoutItem Text="Undo" />
<MenuFlyoutItem Text="Cut" />
<MenuFlyoutItem Text="Copy" />
<MenuFlyoutItem Text="Paste" />
</muxc:MenuBarItem>
<muxc:MenuBarItem Title="Help">
<MenuFlyoutItem Text="About" />
</muxc:MenuBarItem>
</muxc:MenuBar>
<muxc:ProgressRing Margin="0,0,0,8" IsActive="True" />
<muxc:ProgressBar
Width="130"
Margin="0,0,0,8"
IsIndeterminate="True"
ShowError="False"
ShowPaused="False" />
<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" />
<TimePicker Margin="0,0,0,8" />
<DatePicker />
<muxc:NumberBox
x:Name="NumberBoxSpinButtonPlacementExample"
Header="Enter an integer:"
LargeChange="100"
SmallChange="10"
SpinButtonPlacementMode="Compact"
Value="1" />
<muxc:RadioButtons Header="Options:">
<RadioButton Content="Option 1" />
<RadioButton Content="Option 2" />
<RadioButton Content="Option 3" />
</muxc:RadioButtons>
<StackPanel>
<CheckBox
x:Name="OptionsAllCheckBox"
Content="Select all"
IsThreeState="True" />
<CheckBox
x:Name="Option1CheckBox"
Margin="24,0,0,0"
Content="Option 1" />
<CheckBox
x:Name="Option2CheckBox"
Margin="24,0,0,0"
Content="Option 2"
IsChecked="True" />
<CheckBox
x:Name="Option3CheckBox"
Margin="24,0,0,0"
Content="Option 3" />
</StackPanel>
<muxc:RatingControl AutomationProperties.Name="RatingControl with placeholder" PlaceholderValue="0" />
</StackPanel>
</UserControl>
</controls:NotificationFlyout>
@@ -1,27 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace NotificationFlyoutSample
namespace NotificationFlyoutSample
{
public sealed partial class Shell : UserControl
public sealed partial class Shell
{
public Shell()
{
this.InitializeComponent();
InitializeComponent();
}
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;
}
}
}
}
@@ -6,6 +6,9 @@
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
IconSource="/Assets/Icon.ico"
LightIconSource="/Assets/Icon-Light.ico">
<controls:NotificationFlyout.ContextMenuItems>
<MenuFlyoutItem Text="Close" />
</controls:NotificationFlyout.ContextMenuItems>
<StackPanel Margin="24">
<ComboBox
x:Name="Theme"