From ab7ea6415d6a3f28e2b0a782ece301572fa99ae8 Mon Sep 17 00:00:00 2001 From: Daniel Clark Date: Mon, 1 Mar 2021 17:20:10 +0000 Subject: [PATCH] Remove test code for resizing until a better solution comes up --- .../NotificationFlyout/NotificationFlyout.cs | 48 +------------------ .../NotificationFlyout.xaml | 7 --- .../XamlHost/TransparentXamlHost.cs | 10 ++-- 3 files changed, 8 insertions(+), 57 deletions(-) diff --git a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs index f0cd57e..260ef7b 100644 --- a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs +++ b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs @@ -66,7 +66,6 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls internal event EventHandler PlacementPropertyChanged; - public ImageSource IconSource { get => (ImageSource)GetValue(IconSourceProperty); @@ -199,7 +198,6 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls break; } - TemplateSettings.SetValue(NotificationFlyoutTemplateSettings.HeightProperty, height); TemplateSettings.SetValue(NotificationFlyoutTemplateSettings.WidthProperty, width); @@ -225,28 +223,11 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls ShowMode = FlyoutShowMode.Standard }); } + internal void UpdateTheme(bool isColorPrevalence) => VisualStateManager.GoToState(this, isColorPrevalence ? "ColorPrevalenceTheme" : "DefaultTheme", true); - private Rectangle _topThumb; - private Grid _layoutRoot; - - protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e) - { - base.OnManipulationDelta(e); - } protected override void OnApplyTemplate() { - _layoutRoot = GetTemplateChild("LayoutRoot") as Grid; - _layoutRoot.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); - - _topThumb = GetTemplateChild("TopThumb") as Rectangle; - _topThumb.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY; - - _topThumb.ManipulationDelta += _topThumb_ManipulationDelta; - _topThumb.PointerPressed += _topThumb_PointerPressed; - _topThumb.PointerReleased += _topThumb_PointerReleased; - - _container = GetTemplateChild("Container") as Border; if (_container != null) { @@ -274,33 +255,6 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls } } - private void _topThumb_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) - { - _layoutRoot.Height = _layoutRoot.ActualHeight; - _layoutRoot.Height -= e.Delta.Translation.Y ; - - _popup.SetValue(Popup.VerticalOffsetProperty, _popup.VerticalOffset += e.Delta.Translation.Y); - } - - private void _topThumb_PointerReleased(object sender, PointerRoutedEventArgs e) - { - // XamlRoot.Content.ReleasePointerCapture(e.Pointer); - } - - private void _topThumb_PointerPressed(object sender, PointerRoutedEventArgs e) - { - //XamlRoot.Content.CapturePointer(e.Pointer); - } - - private void _topThumb_DragDelta(object sender, DragDeltaEventArgs e) - { - - _layoutRoot.Height = _layoutRoot.ActualHeight; - _layoutRoot.Height -= e.VerticalChange; - - _popup.SetValue(Popup.VerticalOffsetProperty, _popup.VerticalOffset += e.VerticalChange); - } - private static void OnIconPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { var sender = dependencyObject as NotificationFlyout; diff --git a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.xaml b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.xaml index 9505f75..6f033c2 100644 --- a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.xaml +++ b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.xaml @@ -51,8 +51,6 @@ - - - diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs index daaf146..3cb2021 100644 --- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs +++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs @@ -2,22 +2,26 @@ using System; using System.Windows; using System.Windows.Media; +using System.Windows.Threading; namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls { internal class TransparentXamlHost : XamlHost where TXamlContent : Windows.UI.Xaml.UIElement { - internal const double WindowSize = 10; + internal const double WindowSize = 1; public TransparentXamlHost() => PrepareDefaultWindow(); - protected override void OnContentRendered(EventArgs args) => Hide(); - protected override WindowsXamlHost OnPreparingXamlHost(WindowsXamlHost xamlHost) { xamlHost.Height = 0; xamlHost.Width = 0; + Dispatcher.BeginInvoke(new Action(() => + { + Hide(); + }), DispatcherPriority.ContextIdle, null); + return base.OnPreparingXamlHost(xamlHost); }