public void When_TransformToRoot()
        {
            var windowBounds = Windows.UI.Xaml.Window.Current.Bounds;
            var originAbs    = new Point(windowBounds.Width - Border1.ActualWidth, windowBounds.Height - Border1.ActualHeight);

            var sut    = Border1.TransformToVisual(null);
            var result = sut.TransformBounds(new Rect(0, 0, 50, 50));

            Assert.AreEqual(new Rect(originAbs.X, originAbs.Y, 50, 50), result);
        }
示例#2
0
        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";
        }