implemented FullRight placement mode

This commit is contained in:
Daniel Clark
2021-02-27 20:19:58 +00:00
parent 47540457b8
commit efc2f75d85
8 changed files with 226 additions and 74 deletions
@@ -2,17 +2,26 @@
x:Class="NotificationFlyoutSample.SampleFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:TheXamlGuy.NotificationFlyout.Uwp.UI.Controls"
Placement="Auto">
xmlns:controls="using:TheXamlGuy.NotificationFlyout.Uwp.UI.Controls">
<controls:NotificationFlyout.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Click="OnCloseMenuFlyoutItemClick" Text="Close" />
</MenuFlyout>
</controls:NotificationFlyout.ContextFlyout>
<Grid>
<Button
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="Hello World!" />
</Grid>
<StackPanel
Width="400"
Height="500"
Margin="24"
VerticalAlignment="Top">
<ToggleSwitch
Header="Is light dimissed enabled"
IsOn="True"
OffContent="False"
OnContent="True"
Toggled="ToggleSwitch_Toggled" />
<ComboBox Header="Placement" SelectionChanged="ComboBox_SelectionChanged">
<ComboBoxItem Content="Auto" />
<ComboBoxItem Content="FullRight" />
</ComboBox>
</StackPanel>
</controls:NotificationFlyout>
@@ -1,4 +1,6 @@
using Windows.UI.Xaml;
using TheXamlGuy.NotificationFlyout.Uwp.UI.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace NotificationFlyoutSample
{
@@ -14,5 +16,32 @@ namespace NotificationFlyoutSample
var app = GetApplication();
app.Exit();
}
private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
{
var toggleSwitch = sender as ToggleSwitch;
if (toggleSwitch.IsOn)
{
this.IsLightDismissEnabled = true;
}
else
{
this.IsLightDismissEnabled = false;
}
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var comboBox = sender as ComboBox;
if (comboBox.SelectedIndex == 0)
{
this.Placement = NotificationFlyoutPlacement.Auto;
}
else
{
this.Placement = NotificationFlyoutPlacement.FullRight;
}
}
}
}