Reorg project folders
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Markup;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
[ContentProperty(Name = "Content")]
|
||||
public class NotificationFlyout : DependencyObject
|
||||
{
|
||||
public static readonly DependencyProperty FlyoutPresenterStyleProperty =
|
||||
DependencyProperty.Register(nameof(FlyoutPresenterStyle),
|
||||
typeof(Style), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty IconSourceProperty =
|
||||
DependencyProperty.Register(nameof(IconSource),
|
||||
typeof(ImageSource), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(null, OnIconPropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty LightIconSourceProperty =
|
||||
DependencyProperty.Register(nameof(LightIconSource),
|
||||
typeof(ImageSource), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty RequestedThemeProperty =
|
||||
DependencyProperty.Register(nameof(RequestedTheme),
|
||||
typeof(ElementTheme), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(ElementTheme.Default));
|
||||
|
||||
public static DependencyProperty ContentProperty =
|
||||
DependencyProperty.Register(nameof(Content),
|
||||
typeof(UIElement), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public static DependencyProperty ContextMenuProperty =
|
||||
DependencyProperty.Register(nameof(ContextMenu),
|
||||
typeof(NotificationFlyoutContextMenu), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(null, OnContextMenuPropertyChanged));
|
||||
|
||||
private static INotificationFlyoutApplication _applicationInstance;
|
||||
|
||||
public event EventHandler<object> Closed;
|
||||
public event TypedEventHandler<NotificationFlyout, NotificationFlyoutClosingEventArgs> Closing;
|
||||
public event EventHandler<object> Opened;
|
||||
public event EventHandler<object> Opening;
|
||||
|
||||
internal event EventHandler ContextMenuChanged;
|
||||
internal event EventHandler IconSourceChanged;
|
||||
|
||||
public UIElement Content
|
||||
{
|
||||
get => (UIElement)GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public NotificationFlyoutContextMenu ContextMenu
|
||||
{
|
||||
get => (NotificationFlyoutContextMenu)GetValue(ContextMenuProperty);
|
||||
set => SetValue(ContextMenuProperty, value);
|
||||
}
|
||||
|
||||
public Style FlyoutPresenterStyle
|
||||
{
|
||||
get => (Style)GetValue(FlyoutPresenterStyleProperty);
|
||||
set => SetValue(FlyoutPresenterStyleProperty, value);
|
||||
}
|
||||
|
||||
public ImageSource IconSource
|
||||
{
|
||||
get => (ImageSource)GetValue(IconSourceProperty);
|
||||
set => SetValue(IconSourceProperty, value);
|
||||
}
|
||||
|
||||
public ImageSource LightIconSource
|
||||
{
|
||||
get => (ImageSource)GetValue(LightIconSourceProperty);
|
||||
set => SetValue(LightIconSourceProperty, value);
|
||||
}
|
||||
|
||||
public ElementTheme RequestedTheme
|
||||
{
|
||||
get => (ElementTheme)GetValue(RequestedThemeProperty);
|
||||
set => SetValue(RequestedThemeProperty, value);
|
||||
}
|
||||
|
||||
public static INotificationFlyoutApplication GetApplication() => _applicationInstance;
|
||||
|
||||
internal static void SetApplication(INotificationFlyoutApplication application) => _applicationInstance = application;
|
||||
|
||||
internal void InvokeClosedEvent(object obj) => Closed?.Invoke(this, obj);
|
||||
|
||||
internal void InvokeClosingEvent(NotificationFlyoutClosingEventArgs eventArgs) => Closing?.Invoke(this, eventArgs);
|
||||
|
||||
internal void InvokeOpenedEvent(object obj) => Opened?.Invoke(this, obj);
|
||||
|
||||
internal void InvokeOpeningEvent(object obj) => Opening?.Invoke(this, obj);
|
||||
|
||||
private static void OnContextMenuPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
var sender = dependencyObject as NotificationFlyout;
|
||||
sender?.OnContextMenuPropertyChanged();
|
||||
}
|
||||
|
||||
private static void OnIconPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
var sender = dependencyObject as NotificationFlyout;
|
||||
sender?.OnIconPropertyChanged();
|
||||
}
|
||||
|
||||
private void OnContextMenuPropertyChanged() => ContextMenuChanged?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
private void OnIconPropertyChanged() => IconSourceChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
public sealed class NotificationFlyoutClosingEventArgs : EventArgs
|
||||
{
|
||||
public bool Cancel { get; set; }
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Markup;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
[ContentProperty(Name = "MenuItems")]
|
||||
public class NotificationFlyoutContextMenu : DependencyObject
|
||||
{
|
||||
public static DependencyProperty MenuItemsProperty =
|
||||
DependencyProperty.Register(nameof(MenuItems),
|
||||
typeof(IList<MenuFlyoutItemBase>), typeof(NotificationFlyout),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public NotificationFlyoutContextMenu() => MenuItems = new ObservableCollection<MenuFlyoutItemBase>();
|
||||
|
||||
public IList<MenuFlyoutItemBase> MenuItems
|
||||
{
|
||||
get => (IList<MenuFlyoutItemBase>)GetValue(MenuItemsProperty);
|
||||
set => SetValue(MenuItemsProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
internal class NotificationFlyoutContextMenuFlyoutHost : Control
|
||||
{
|
||||
private NotificationFlyout _flyout;
|
||||
private MenuFlyout _menuFlyout;
|
||||
private Grid _root;
|
||||
|
||||
public NotificationFlyoutContextMenuFlyoutHost() => DefaultStyleKey = typeof(NotificationFlyoutContextMenuFlyoutHost);
|
||||
|
||||
public void HideFlyout()
|
||||
{
|
||||
if (_menuFlyout == null) return;
|
||||
_menuFlyout.Hide();
|
||||
}
|
||||
|
||||
public void ShowFlyout()
|
||||
{
|
||||
if (_root == null) return;
|
||||
if (_menuFlyout == null) return;
|
||||
|
||||
_menuFlyout.ShowAt(_root, new FlyoutShowOptions
|
||||
{
|
||||
Placement = FlyoutPlacementMode.BottomEdgeAlignedLeft,
|
||||
ShowMode = FlyoutShowMode.TransientWithDismissOnPointerMoveAway
|
||||
});
|
||||
}
|
||||
|
||||
internal void SetOwningFlyout(NotificationFlyout flyout)
|
||||
{
|
||||
if (_flyout != null)
|
||||
{
|
||||
(_flyout.ContextMenu.MenuItems as INotifyCollectionChanged).CollectionChanged -= OnContextMenuItemsChanged;
|
||||
}
|
||||
|
||||
_flyout = flyout;
|
||||
|
||||
var contextMenu = _flyout.ContextMenu;
|
||||
if (contextMenu == null) return;
|
||||
|
||||
(contextMenu.MenuItems as INotifyCollectionChanged).CollectionChanged += OnContextMenuItemsChanged;
|
||||
|
||||
PrepareMenuItems();
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
_root = GetTemplateChild("Root") as Grid;
|
||||
_menuFlyout = GetTemplateChild("Flyout") as MenuFlyout;
|
||||
|
||||
PrepareMenuItems();
|
||||
}
|
||||
|
||||
private void OnContextMenuItemsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||
{
|
||||
if (_flyout == null) return;
|
||||
|
||||
var contextMenu = _flyout.ContextMenu;
|
||||
if (contextMenu == null) return;
|
||||
|
||||
var addedItems = args.NewItems.Cast<MenuFlyoutItemBase>().ToList();
|
||||
var removedItems = args.NewItems.Cast<MenuFlyoutItemBase>().ToList();
|
||||
|
||||
if (removedItems != null)
|
||||
{
|
||||
foreach (var item in removedItems)
|
||||
{
|
||||
_menuFlyout.Items.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in addedItems)
|
||||
{
|
||||
_menuFlyout.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrepareMenuItems()
|
||||
{
|
||||
if (_menuFlyout == null) return;
|
||||
if (_flyout == null) return;
|
||||
|
||||
var contextMenu = _flyout.ContextMenu;
|
||||
if (contextMenu == null) return;
|
||||
|
||||
_menuFlyout.Items.Clear();
|
||||
|
||||
var items = contextMenu.MenuItems;
|
||||
foreach (var item in items)
|
||||
{
|
||||
_menuFlyout.Items.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<ResourceDictionary
|
||||
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">
|
||||
<Style TargetType="controls:NotificationFlyoutContextMenuFlyoutHost">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:NotificationFlyoutContextMenuFlyoutHost">
|
||||
<Grid x:Name="Root">
|
||||
<FlyoutBase.AttachedFlyout>
|
||||
<MenuFlyout x:Name="Flyout" />
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
using System.Numerics;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
internal class NotificationFlyoutHost : Control
|
||||
{
|
||||
public static readonly DependencyProperty ContentProperty =
|
||||
DependencyProperty.Register(nameof(Content),
|
||||
typeof(UIElement), typeof(NotificationFlyoutHost),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public static readonly DependencyProperty FlyoutPresenterStyleProperty =
|
||||
DependencyProperty.Register(nameof(FlyoutPresenterStyle),
|
||||
typeof(Style), typeof(NotificationFlyoutHost),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
private Flyout _flyout;
|
||||
private bool _isLoaded;
|
||||
private NotificationFlyout _notificationFlyout;
|
||||
private string _placement;
|
||||
private Grid _root;
|
||||
|
||||
public NotificationFlyoutHost() => DefaultStyleKey = typeof(NotificationFlyoutHost);
|
||||
|
||||
public UIElement Content
|
||||
{
|
||||
get => (UIElement)GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public Style FlyoutPresenterStyle
|
||||
{
|
||||
get => (Style)GetValue(FlyoutPresenterStyleProperty);
|
||||
set => SetValue(FlyoutPresenterStyleProperty, value);
|
||||
}
|
||||
|
||||
public void HideFlyout()
|
||||
{
|
||||
if (_root == null) return;
|
||||
FlyoutBase flyout = FlyoutBase.GetAttachedFlyout(_root);
|
||||
flyout.Hide();
|
||||
}
|
||||
|
||||
internal void UpdateThemeVisualState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetFlyoutPlacement(string placement)
|
||||
{
|
||||
if (!_isLoaded)
|
||||
{
|
||||
_placement = placement;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(placement)) return;
|
||||
VisualStateManager.GoToState(this, placement, true);
|
||||
}
|
||||
|
||||
public void ShowFlyout(FlyoutPlacementMode placementMode)
|
||||
{
|
||||
if (_root == null) return;
|
||||
var flyout = FlyoutBase.GetAttachedFlyout(_root);
|
||||
flyout.ShowAt(_root, new FlyoutShowOptions
|
||||
{
|
||||
Placement = placementMode,
|
||||
ShowMode = FlyoutShowMode.Transient,
|
||||
});
|
||||
}
|
||||
|
||||
internal void SetOwningFlyout(NotificationFlyout flyout)
|
||||
{
|
||||
_notificationFlyout = flyout;
|
||||
|
||||
BindingOperations.SetBinding(this, ContentProperty,
|
||||
new Binding
|
||||
{
|
||||
Source = _notificationFlyout,
|
||||
Path =
|
||||
new PropertyPath(nameof(Content)),
|
||||
Mode = BindingMode.TwoWay
|
||||
});
|
||||
|
||||
BindingOperations.SetBinding(this, RequestedThemeProperty,
|
||||
new Binding
|
||||
{
|
||||
Source = _notificationFlyout,
|
||||
Path = new PropertyPath(nameof(RequestedTheme)),
|
||||
Mode = BindingMode.TwoWay
|
||||
});
|
||||
|
||||
BindingOperations.SetBinding(this, FlyoutPresenterStyleProperty,
|
||||
new Binding
|
||||
{
|
||||
Source = _notificationFlyout,
|
||||
Path = new PropertyPath(nameof(FlyoutPresenterStyle)),
|
||||
Mode = BindingMode.TwoWay
|
||||
});
|
||||
}
|
||||
|
||||
private NotificationFlyoutPresenter _flyoutPresenter;
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
_flyoutPresenter = GetTemplateChild("FlyoutPresenter") as NotificationFlyoutPresenter;
|
||||
|
||||
_flyout = GetTemplateChild("Flyout") as Flyout;
|
||||
if (_flyout != null)
|
||||
{
|
||||
_flyout.Closing -= OnFlyoutClosing;
|
||||
_flyout.Closed -= OnFlyoutClosed;
|
||||
_flyout.Opening -= OnFlyoutOpening;
|
||||
_flyout.Opened -= OnFlyoutOpened;
|
||||
|
||||
_flyout.Closing += OnFlyoutClosing;
|
||||
_flyout.Closed += OnFlyoutClosed;
|
||||
_flyout.Opening += OnFlyoutOpening;
|
||||
_flyout.Opened += OnFlyoutOpened;
|
||||
}
|
||||
|
||||
_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);
|
||||
}
|
||||
|
||||
private void OnFlyoutClosed(object sender, object args) => _notificationFlyout?.InvokeClosedEvent(args);
|
||||
|
||||
private void OnFlyoutClosing(FlyoutBase sender, FlyoutBaseClosingEventArgs args) => _notificationFlyout?.InvokeClosingEvent(new NotificationFlyoutClosingEventArgs());
|
||||
|
||||
private void OnFlyoutOpened(object sender, object args) => _notificationFlyout?.InvokeOpenedEvent(args);
|
||||
|
||||
private void OnFlyoutOpening(object sender, object args) => _notificationFlyout?.InvokeOpeningEvent(args);
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<ResourceDictionary
|
||||
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">
|
||||
<Style TargetType="controls:NotificationFlyoutHost">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:NotificationFlyoutHost">
|
||||
<Grid x:Name="Root">
|
||||
<Grid.Resources>
|
||||
<Style x:Key="DefaultFlyoutPresenterStyle" TargetType="FlyoutPresenter">
|
||||
<Setter Property="IsDefaultShadowEnabled" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="FlyoutPresenter">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="TopFlyoutPresenterStyle"
|
||||
BasedOn="{StaticResource DefaultFlyoutPresenterStyle}"
|
||||
TargetType="FlyoutPresenter">
|
||||
<Setter Property="Margin" Value="0,-7,0,0" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="BottomFlyoutPresenterStyle"
|
||||
BasedOn="{StaticResource DefaultFlyoutPresenterStyle}"
|
||||
TargetType="FlyoutPresenter">
|
||||
<Setter Property="Margin" Value="0,7,0,0" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="LeftFlyoutPresenterStyle"
|
||||
BasedOn="{StaticResource DefaultFlyoutPresenterStyle}"
|
||||
TargetType="FlyoutPresenter">
|
||||
<Setter Property="Margin" Value="-7,0,0,0" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="RightFlyoutPresenterStyle"
|
||||
BasedOn="{StaticResource DefaultFlyoutPresenterStyle}"
|
||||
TargetType="FlyoutPresenter">
|
||||
<Setter Property="Margin" Value="7,0,0,0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<FlyoutBase.AttachedFlyout>
|
||||
<Flyout
|
||||
x:Name="Flyout"
|
||||
AreOpenCloseAnimationsEnabled="False"
|
||||
FlyoutPresenterStyle="{StaticResource BottomFlyoutPresenterStyle}"
|
||||
ShouldConstrainToRootBounds="False">
|
||||
<Grid x:Name="ContentRoot">
|
||||
<Grid.Transitions>
|
||||
<TransitionCollection>
|
||||
<EntranceThemeTransition
|
||||
x:Name="EntranceThemeTransition"
|
||||
FromHorizontalOffset="0"
|
||||
FromVerticalOffset="0" />
|
||||
</TransitionCollection>
|
||||
</Grid.Transitions>
|
||||
<controls:NotificationFlyoutPresenter x:Name="FlyoutPresenter" Content="{TemplateBinding Content}" Style="{TemplateBinding FlyoutPresenterStyle}" />
|
||||
</Grid>
|
||||
</Flyout>
|
||||
</FlyoutBase.AttachedFlyout>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="PlacementStates">
|
||||
<VisualState x:Name="Bottom">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Flyout.FlyoutPresenterStyle" Value="{StaticResource BottomFlyoutPresenterStyle}" />
|
||||
<Setter Target="EntranceThemeTransition.FromHorizontalOffset" Value="0" />
|
||||
<Setter Target="EntranceThemeTransition.FromVerticalOffset" Value="80" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Top">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Flyout.FlyoutPresenterStyle" Value="{StaticResource TopFlyoutPresenterStyle}" />
|
||||
<Setter Target="EntranceThemeTransition.FromHorizontalOffset" Value="0" />
|
||||
<Setter Target="EntranceThemeTransition.FromVerticalOffset" Value="-80" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Left">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Flyout.FlyoutPresenterStyle" Value="{StaticResource LeftFlyoutPresenterStyle}" />
|
||||
<Setter Target="EntranceThemeTransition.FromHorizontalOffset" Value="-80" />
|
||||
<Setter Target="EntranceThemeTransition.FromVerticalOffset" Value="0" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Right">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Flyout.FlyoutPresenterStyle" Value="{StaticResource RightFlyoutPresenterStyle}" />
|
||||
<Setter Target="EntranceThemeTransition.FromHorizontalOffset" Value="80" />
|
||||
<Setter Target="EntranceThemeTransition.FromVerticalOffset" Value="0" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
internal class NotificationFlyoutMenuItemsChangedEventArgs : EventArgs
|
||||
{
|
||||
public NotificationFlyoutMenuItemsChangedEventArgs(IList<MenuFlyoutItemBase> addedItems, IList<MenuFlyoutItemBase> removedItems)
|
||||
{
|
||||
AddedItems = addedItems;
|
||||
RemovedItems = removedItems;
|
||||
}
|
||||
|
||||
public IList<MenuFlyoutItemBase> AddedItems { get; private set; }
|
||||
|
||||
public IList<MenuFlyoutItemBase> RemovedItems { get; private set; }
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
public class NotificationFlyoutPresenter : ContentControl
|
||||
{
|
||||
public NotificationFlyoutPresenter() => DefaultStyleKey = typeof(NotificationFlyoutPresenter);
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<ResourceDictionary
|
||||
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">
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<AcrylicBrush
|
||||
x:Key="AcrylicBackgroundFillColorBrush"
|
||||
BackgroundSource="HostBackdrop"
|
||||
FallbackColor="#2C2C2C"
|
||||
TintColor="#2C2C2C"
|
||||
TintOpacity="0.8" />
|
||||
<StaticResource x:Key="NotificationFlyoutPresenterBackgroundBrush" ResourceKey="AcrylicBackgroundFillColorBrush" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<AcrylicBrush
|
||||
x:Key="AcrylicBackgroundFillColorBrush"
|
||||
BackgroundSource="HostBackdrop"
|
||||
FallbackColor="#F9F9F9"
|
||||
TintColor="#FCFCFC"
|
||||
TintOpacity="0.8" />
|
||||
<StaticResource x:Key="NotificationFlyoutPresenterBackgroundBrush" ResourceKey="AcrylicBackgroundFillColorBrush" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<SolidColorBrush x:Key="NotificationFlyoutPresenterBackgroundBrush" Color="Green" />
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
<AcrylicBrush
|
||||
x:Key="NotificationFlyoutPresenterBackgroundAccentBrush"
|
||||
BackgroundSource="HostBackdrop"
|
||||
FallbackColor="{StaticResource SystemAccentColorDark1}"
|
||||
TintColor="{StaticResource SystemAccentColorDark1}"
|
||||
TintOpacity="0.8" />
|
||||
<Style TargetType="controls:NotificationFlyoutPresenter">
|
||||
<Setter Property="Background" Value="{ThemeResource NotificationFlyoutPresenterBackgroundBrush}" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:NotificationFlyoutPresenter">
|
||||
<Border
|
||||
x:Name="Root"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BackgroundSizing="OuterBorderEdge"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ScrollViewer
|
||||
x:Name="ScrollViewer"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
|
||||
<ContentControl
|
||||
x:Name="ContentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
||||
</ScrollViewer>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="ThemeStates">
|
||||
<VisualState x:Name="DefaultTheme" />
|
||||
<VisualState x:Name="ColorPrevalenceTheme">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="Root.Background" Value="{ThemeResource NotificationFlyoutPresenterBackgroundAccentBrush}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("NotificationFlyout.Uwp.UI.Controls")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("TheXamlGuy")]
|
||||
[assembly: AssemblyProduct("NotificationFlyout")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: InternalsVisibleTo("NotificationFlyout.Wpf.UI.Controls")]
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<Project Sdk="MSBuild.Sdk.Extras">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>uap10.0.19041</TargetFrameworks>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
|
||||
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<Company>TheXamlGuy</Company>
|
||||
<Authors>TheXamlGuy</Authors>
|
||||
<Product>NotificationFlyout</Product>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Include="NotificationFlyout\NotificationFlyoutContextMenuFlyoutHost.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="NotificationFlyout\NotificationFlyoutHost.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="NotificationFlyout\NotificationFlyoutPresenter.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Generic.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ms-appx:///NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyoutHost.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyoutPresenter.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyoutContextMenuFlyoutHost.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user