public void When_TransformToRoot_With_TranslateTransform() { var windowBounds = Windows.UI.Xaml.Window.Current.Bounds; var originAbs = new Point(windowBounds.Width - Border2.ActualWidth, windowBounds.Height - Border2.ActualHeight); const int tX = -50; const int tY = -50; var sut = Border2.TransformToVisual(null); var result = sut.TransformBounds(new Rect(0, 0, 50, 50)); Assert.AreEqual(new Rect(originAbs.X + tX, originAbs.Y + tY, 50, 50), result); }
private async void TransformToVisual_Transform_Loaded(object sender, RoutedEventArgs e) { await Task.Yield(); var tr1 = Border1.TransformToVisual(null) as MatrixTransform; var tr2 = Border2.TransformToVisual(null) as MatrixTransform; var windowBounds = Windows.UI.Xaml.Window.Current.Bounds; WindowWidth.Text = windowBounds.Width.ToString(); WindowHeight.Text = windowBounds.Height.ToString(); Border1TransformNullX.Text = tr1.Matrix.OffsetX.ToString(); Border1TransformNullY.Text = tr1.Matrix.OffsetY.ToString(); Border2TransformNullX.Text = tr2.Matrix.OffsetX.ToString(); Border2TransformNullY.Text = tr2.Matrix.OffsetY.ToString(); IsLoadedText.Text = "Loaded"; }