Убраны синхронные методы
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace Lattice.UI.DragDrop.WinUI.Helpers;
|
||||
|
||||
public static class FrameworkElementExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Получает фактические размеры FrameworkElement.
|
||||
/// </summary>
|
||||
public static Windows.Foundation.Size GetActualSize(this FrameworkElement element)
|
||||
{
|
||||
return new Windows.Foundation.Size(element.ActualWidth, element.ActualHeight);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получает границы элемента в экранных координатах.
|
||||
/// </summary>
|
||||
public static Windows.Foundation.Rect GetScreenBounds(this FrameworkElement element)
|
||||
{
|
||||
var transform = element.TransformToVisual(null);
|
||||
var topLeft = transform.TransformPoint(new Windows.Foundation.Point(0, 0));
|
||||
var bottomRight = transform.TransformPoint(new Windows.Foundation.Point(element.ActualWidth, element.ActualHeight));
|
||||
|
||||
return new Windows.Foundation.Rect(topLeft, bottomRight);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user