12 changed files with 9 additions and 153 deletions
@ -1,19 +0,0 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|||
x:Class="IntegrationTestApp.Pages.PointerPage"> |
|||
<StackPanel> |
|||
<!-- Trigger with PointerPressed rather using a Button so we have access to the pointer. --> |
|||
<Border Name="PointerPageShowDialog" |
|||
Background="{DynamicResource ButtonBackground}" |
|||
HorizontalAlignment="Left" |
|||
Padding="{DynamicResource ButtonPadding}" |
|||
AutomationProperties.AccessibilityView="Control" |
|||
PointerPressed="PointerPageShowDialog_PointerPressed"> |
|||
<TextBlock>Show Dialog</TextBlock> |
|||
</Border> |
|||
<TextBlock Name="PointerCaptureStatus"/> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -1,47 +0,0 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Input; |
|||
|
|||
namespace IntegrationTestApp.Pages; |
|||
|
|||
public partial class PointerPage : UserControl |
|||
{ |
|||
public PointerPage() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
private void PointerPageShowDialog_PointerPressed(object? sender, PointerPressedEventArgs e) |
|||
{ |
|||
void CaptureLost(object? sender, PointerCaptureLostEventArgs e) |
|||
{ |
|||
PointerCaptureStatus.Text = "None"; |
|||
((Control)sender!).PointerCaptureLost -= CaptureLost; |
|||
} |
|||
|
|||
var window = TopLevel.GetTopLevel(this) as Window ?? |
|||
throw new AvaloniaInternalException("PointerPage is not attached to a Window."); |
|||
var captured = e.Pointer.Captured as Control; |
|||
|
|||
if (captured is not null) |
|||
{ |
|||
captured.PointerCaptureLost += CaptureLost; |
|||
} |
|||
|
|||
PointerCaptureStatus.Text = captured?.ToString() ?? "None"; |
|||
|
|||
var dialog = new Window |
|||
{ |
|||
Width = 200, |
|||
Height = 200, |
|||
}; |
|||
|
|||
dialog.Content = new Button |
|||
{ |
|||
Content = "Close", |
|||
Command = new DelegateCommand(() => dialog.Close()), |
|||
}; |
|||
|
|||
dialog.ShowDialog(window); |
|||
} |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|||
x:Class="IntegrationTestApp.Pages.ScreensPage"> |
|||
<StackPanel Spacing="4"> |
|||
<Button Name="ScreenRefresh" |
|||
Content="Refresh" |
|||
Click="ScreenRefresh_Click"/> |
|||
<TextBox Name="ScreenName" Watermark="DisplayName" UseFloatingWatermark="true" /> |
|||
<TextBox Name="ScreenHandle" Watermark="Handle" UseFloatingWatermark="true" /> |
|||
<TextBox Name="ScreenScaling" Watermark="Scaling" UseFloatingWatermark="true" /> |
|||
<TextBox Name="ScreenBounds" Watermark="Bounds" UseFloatingWatermark="true" /> |
|||
<TextBox Name="ScreenWorkArea" Watermark="WorkArea" UseFloatingWatermark="true" /> |
|||
<TextBox Name="ScreenOrientation" Watermark="Orientation" UseFloatingWatermark="true" /> |
|||
<TextBox Name="ScreenSameReference" Watermark="Is same reference" UseFloatingWatermark="true" /> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -1,32 +0,0 @@ |
|||
using System.Globalization; |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace IntegrationTestApp.Pages; |
|||
|
|||
public partial class ScreensPage : UserControl |
|||
{ |
|||
private Screen? _lastScreen; |
|||
|
|||
public ScreensPage() |
|||
{ |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
private void ScreenRefresh_Click(object? sender, RoutedEventArgs e) |
|||
{ |
|||
var window = TopLevel.GetTopLevel(this) as Window ?? |
|||
throw new AvaloniaInternalException("ScreensPage is not attached to a Window."); |
|||
var lastScreen = _lastScreen; |
|||
var screen = _lastScreen = window.Screens.ScreenFromWindow(window); |
|||
ScreenName.Text = screen?.DisplayName; |
|||
ScreenHandle.Text = screen?.TryGetPlatformHandle()?.ToString(); |
|||
ScreenBounds.Text = screen?.Bounds.ToString(); |
|||
ScreenWorkArea.Text = screen?.WorkingArea.ToString(); |
|||
ScreenScaling.Text = screen?.Scaling.ToString(CultureInfo.InvariantCulture); |
|||
ScreenOrientation.Text = screen?.CurrentOrientation.ToString(); |
|||
ScreenSameReference.Text = ReferenceEquals(lastScreen, screen).ToString(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue