fix issue with DPI
This commit is contained in:
+46
@@ -7,6 +7,7 @@ using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
|
||||
namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
|
||||
{
|
||||
@@ -226,8 +227,26 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
|
||||
}
|
||||
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)
|
||||
{
|
||||
@@ -255,6 +274,33 @@ 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;
|
||||
|
||||
+26
-17
@@ -50,23 +50,32 @@
|
||||
<EntranceThemeTransition x:Name="EntranceThemeTransition" />
|
||||
</TransitionCollection>
|
||||
</Border.Transitions>
|
||||
<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>
|
||||
<Grid>
|
||||
|
||||
|
||||
<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>
|
||||
<Rectangle
|
||||
x:Name="TopThumb"
|
||||
Height="10"
|
||||
VerticalAlignment="Top"
|
||||
Fill="Red" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
|
||||
+2
@@ -22,6 +22,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TheXamlGuy.NotificationFlyout.Common\TheXamlGuy.NotificationFlyout.Common.csproj" />
|
||||
<ProjectReference Include="..\TheXamlGuy.NotificationFlyout.Shared.UI\TheXamlGuy.NotificationFlyout.Shared.UI.csproj" />
|
||||
<ProjectReference Include="..\TheXamlGuy.NotificationFlyout.Uwp.UI.Controls\TheXamlGuy.NotificationFlyout.Uwp.UI.Controls.csproj" />
|
||||
<ProjectReference Include="..\TheXamlGuy.NotificationFlyout.Wpf.UI\TheXamlGuy.NotificationFlyout.Wpf.UI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System;
|
||||
|
||||
namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
|
||||
{
|
||||
@@ -9,11 +10,9 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
|
||||
{
|
||||
internal const double WindowSize = 0;
|
||||
|
||||
public TransparentXamlHost()
|
||||
{
|
||||
Loaded += OnLoaded;
|
||||
PrepareDefaultWindow();
|
||||
}
|
||||
public TransparentXamlHost() => PrepareDefaultWindow();
|
||||
|
||||
protected override void OnContentRendered(EventArgs args) => Visibility = Visibility.Hidden;
|
||||
|
||||
protected override WindowsXamlHost OnPreparingXamlHost(WindowsXamlHost xamlHost)
|
||||
{
|
||||
@@ -22,16 +21,9 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
|
||||
|
||||
return base.OnPreparingXamlHost(xamlHost);
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs args)
|
||||
{
|
||||
this.Hidden();
|
||||
}
|
||||
|
||||
private void PrepareDefaultWindow()
|
||||
{
|
||||
ShowInTaskbar = false;
|
||||
ShowActivated = false;
|
||||
WindowStyle = WindowStyle.None;
|
||||
ResizeMode = ResizeMode.NoResize;
|
||||
AllowsTransparency = true;
|
||||
|
||||
@@ -31,7 +31,11 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions
|
||||
public static void Hidden(this Window window)
|
||||
{
|
||||
var handle = window.GetHandle();
|
||||
PInvoke.SetWindowLong((HWND)handle, GWL_EX_STYLE, (PInvoke.GetWindowLong((HWND)handle, GWL_EX_STYLE) | (int)WindowFlag.WS_EX_TOOLWINDOW) & ~(int)WindowFlag.WS_EX_APPWINDOW);
|
||||
|
||||
int exStyle = (int)PInvoke.GetWindowLong((HWND)handle, (int)GWL_EX_STYLE);
|
||||
|
||||
exStyle |= (int)WindowFlag.WS_EX_APPWINDOW;
|
||||
PInvoke.SetWindowLong((HWND)handle, (int)GWL_EX_STYLE, exStyle);
|
||||
}
|
||||
|
||||
public static void SetTopAll(this Window window)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TheXamlGuy.NotificationFlyout.Common\TheXamlGuy.NotificationFlyout.Common.csproj" />
|
||||
<ProjectReference Include="..\TheXamlGuy.NotificationFlyout.Shared.UI\TheXamlGuy.NotificationFlyout.Shared.UI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user