Added API for opening a window from flyout w/ sample

This commit is contained in:
Daniel Clark
2021-02-11 15:09:20 +00:00
parent 0d28dad842
commit 4a6c6ca4a5
12 changed files with 182 additions and 77 deletions
@@ -123,6 +123,9 @@
<Compile Include="Shell.xaml.cs">
<DependentUpon>Shell.xaml</DependentUpon>
</Compile>
<Compile Include="WindowContent.xaml.cs">
<DependentUpon>WindowContent.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
@@ -163,6 +166,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WindowContent.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\NotificationFlyout.Uwp.UI.Controls\NotificationFlyout.Uwp.UI.Controls.csproj">
+1 -1
View File
@@ -44,7 +44,7 @@
IsIndeterminate="True"
ShowError="False"
ShowPaused="False" />
<Button Margin="0,0,0,8" Content="Button" />
<Button Margin="0,0,0,8" Content="Open window" Click="Button_Click" />
<Slider Margin="0,0,0,8" />
<TextBox Margin="0,0,0,8" />
<CalendarView Margin="0,0,0,8" />
@@ -28,5 +28,11 @@
var app = GetApplication();
app.Exit();
}
private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
var app = GetApplication();
app.OpenAsWindow<WindowContent>();
}
}
}
@@ -0,0 +1,27 @@
<UserControl
x:Class="NotificationFlyoutSample.WindowContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
<muxc:NavigationView x:Name="nvSample">
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem
Content="Menu Item1"
Icon="Play"
Tag="SamplePage1" />
<muxc:NavigationViewItem
Content="Menu Item2"
Icon="Save"
Tag="SamplePage2" />
<muxc:NavigationViewItem
Content="Menu Item3"
Icon="Refresh"
Tag="SamplePage3" />
<muxc:NavigationViewItem
Content="Menu Item4"
Icon="Download"
Tag="SamplePage4" />
</muxc:NavigationView.MenuItems>
<Frame x:Name="contentFrame" />
</muxc:NavigationView>
</UserControl>
@@ -0,0 +1,27 @@
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
{
public sealed partial class WindowContent : UserControl
{
public WindowContent()
{
this.InitializeComponent();
}
}
}