Skip to content

Commit 1f3dcc7

Browse files
committed
dont use UIElement.ActualSize
1 parent 1b2e483 commit 1f3dcc7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestBox.Helpers.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
1919
/// </summary>
2020
public partial class RichSuggestBox
2121
{
22-
private static bool IsElementOnScreen(UIElement element, double offsetX = 0, double offsetY = 0)
22+
private static bool IsElementOnScreen(FrameworkElement element, double offsetX = 0, double offsetY = 0)
2323
{
2424
var toWindow = element.TransformToVisual(Window.Current.Content);
2525
var windowBounds = ApplicationView.GetForCurrentView().VisibleBounds;
26-
var elementBounds = new Rect(offsetX, offsetY, element.ActualSize.X, element.ActualSize.Y);
26+
var elementBounds = new Rect(offsetX, offsetY, element.ActualWidth, element.ActualHeight);
2727
elementBounds = toWindow.TransformBounds(elementBounds);
2828
elementBounds.X += windowBounds.X;
2929
elementBounds.Y += windowBounds.Y;
@@ -33,15 +33,15 @@ private static bool IsElementOnScreen(UIElement element, double offsetX = 0, dou
3333
return elementBounds.Top * scaleFactor >= 0 && elementBounds.Bottom * scaleFactor <= displayHeight;
3434
}
3535

36-
private static bool IsElementInsideWindow(UIElement element, double offsetX = 0, double offsetY = 0)
36+
private static bool IsElementInsideWindow(FrameworkElement element, double offsetX = 0, double offsetY = 0)
3737
{
3838
var toWindow = element.TransformToVisual(Window.Current.Content);
3939
var windowBounds = ApplicationView.GetForCurrentView().VisibleBounds;
4040
windowBounds = new Rect(0, 0, windowBounds.Width, windowBounds.Height);
41-
var elementBounds = new Rect(offsetX, offsetY, element.ActualSize.X, element.ActualSize.Y);
41+
var elementBounds = new Rect(offsetX, offsetY, element.ActualWidth, element.ActualHeight);
4242
elementBounds = toWindow.TransformBounds(elementBounds);
4343
elementBounds.Intersect(windowBounds);
44-
return elementBounds.Height >= element.ActualSize.Y;
44+
return elementBounds.Height >= element.ActualHeight;
4545
}
4646

4747
private static string EnforcePrefixesRequirements(string value)

0 commit comments

Comments
 (0)