Added shadow support
This commit is contained in:
@@ -2,18 +2,35 @@
|
||||
x:Class="NotificationFlyout.Sample.NotificationFlyoutPresenter"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls">
|
||||
<Grid>
|
||||
<ListBox
|
||||
Width="300"
|
||||
Height="400"
|
||||
Background="Transparent">
|
||||
<ListBoxItem Content="Item 1" />
|
||||
<ListBoxItem Content="Item 2" />
|
||||
<ListBoxItem Content="Item 3" />
|
||||
<ListBoxItem Content="Item 4" />
|
||||
<ListBoxItem Content="Item 5" />
|
||||
<ListBoxItem Content="Item 6" />
|
||||
</ListBox>
|
||||
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls"
|
||||
CornerRadius="8">
|
||||
<Grid
|
||||
Width="330"
|
||||
Height="360"
|
||||
Margin="23">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="Quick lauch" />
|
||||
<GridView Grid.Row="1" HorizontalAlignment="Center">
|
||||
<GridView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<ItemsWrapGrid Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</GridView.ItemsPanel>
|
||||
<Button
|
||||
Width="94"
|
||||
Margin="6,6,3,6"
|
||||
Content="Test" />
|
||||
<Button
|
||||
Width="94"
|
||||
Margin="3,6,3,6"
|
||||
Content="Test" />
|
||||
<Button
|
||||
Width="94"
|
||||
Margin="3,6,6,6"
|
||||
Content="Test" />
|
||||
</GridView>
|
||||
</Grid>
|
||||
</controls:NotificationFlyoutPresenter>
|
||||
|
||||
+13
-1
@@ -1,6 +1,8 @@
|
||||
using Windows.UI.Xaml;
|
||||
using System.Numerics;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
@@ -57,6 +59,16 @@ namespace NotificationFlyout.Uwp.UI.Controls
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
_root = GetTemplateChild("Root") as Grid;
|
||||
|
||||
if (GetTemplateChild("ContentRoot") is Grid contentRoot)
|
||||
{
|
||||
contentRoot.Shadow = new ThemeShadow();
|
||||
|
||||
var currentTranslation = contentRoot.Translation;
|
||||
var translation = new Vector3(currentTranslation.X, currentTranslation.Y, 16.0f);
|
||||
contentRoot.Translation = translation;
|
||||
}
|
||||
|
||||
_isLoaded = true;
|
||||
SetFlyoutPlacement(_placement);
|
||||
}
|
||||
|
||||
+5
-4
@@ -45,16 +45,17 @@
|
||||
AreOpenCloseAnimationsEnabled="False"
|
||||
FlyoutPresenterStyle="{StaticResource BottomFlyoutPresenterStyle}"
|
||||
ShouldConstrainToRootBounds="False">
|
||||
<ContentControl Content="{TemplateBinding FlyoutPresenter}">
|
||||
<ContentControl.Transitions>
|
||||
<Grid x:Name="ContentRoot">
|
||||
<Grid.Transitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition
|
||||
x:Name="EntranceThemeTransition"
|
||||
FromHorizontalOffset="0"
|
||||
FromVerticalOffset="0" />
|
||||
</TransitionCollection>
|
||||
</ContentControl.Transitions>
|
||||
</ContentControl>
|
||||
</Grid.Transitions>
|
||||
<ContentControl Content="{TemplateBinding FlyoutPresenter}" />
|
||||
</Grid>
|
||||
</Flyout>
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
|
||||
+1
@@ -8,6 +8,7 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:NotificationFlyoutPresenter">
|
||||
<Border
|
||||
x:Name="Root"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BackgroundSizing="OuterBorderEdge"
|
||||
|
||||
Reference in New Issue
Block a user