Exemplo n.º 1
0
        public static CompositeTransform3D GetCompositeTransform3D(this FrameworkElement target)
        {
            if (target.Transform3D is not CompositeTransform3D transform)
            {
                transform          = new CompositeTransform3D();
                target.Transform3D = transform;
            }

            return(transform);
        }
Exemplo n.º 2
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _scrollViewer        = GetTemplateChild("ScrollViewer") as ScrollViewer;
            _backgroundTransform = GetTemplateChild("BackgroundTransform") as CompositeTransform3D;

            if (_scrollViewer != null && _backgroundTransform != null)
            {
                _scrollViewer.SizeChanged += ScrollViewer_SizeChanged;
            }
        }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _scrollViewer = GetTemplateChild("ScrollViewer") as ScrollViewer;
            _backgroundTransform = GetTemplateChild("BackgroundTransform") as CompositeTransform3D;

            if (_scrollViewer != null && _backgroundTransform != null)
            {
                _scrollViewer.SizeChanged += ScrollViewer_SizeChanged;
            }
        }
Exemplo n.º 4
0
        public static CompositeTransform3D GetCompositeTransform3D(this FrameworkElement target)
        {
            CompositeTransform3D transform = target.Transform3D as CompositeTransform3D;

            if (transform == null)
            {
                transform          = new CompositeTransform3D();
                target.Transform3D = transform;
            }

            return(transform);
        }
Exemplo n.º 5
0
        private static CompositeTransform3D EnsureTransform(FrameworkElement view)
        {
            var transform          = view.Transform3D;
            var compositeTransform = transform as CompositeTransform3D;

            if (transform != null && compositeTransform == null)
            {
                throw new InvalidOperationException("Unknown transform set on framework element.");
            }

            if (compositeTransform == null)
            {
                compositeTransform = new CompositeTransform3D();
                view.Transform3D   = compositeTransform;
            }

            return(compositeTransform);
        }
        private UIElement CreateSide(double x=0,double y=0, double z=0, double anglex=0, double angley=0, double size = 200, bool fliptext = false)
        {
            var orange = Colors.Orange;
            orange.A = 128;
            var color = new SolidColorBrush(orange);
            var bordercolor = new SolidColorBrush(Colors.White);
            var transform = new CompositeTransform3D()
            {
                CenterX = size / 2,
                CenterY = size / 2,
                CenterZ = 0,
                TranslateX = x,
                TranslateZ = z,
                TranslateY = y,
                RotationX = anglex,
                RotationY = angley
            };
            var newrectangle = new Grid()
            {
                Width = size,
                Height = size,
                Background = color,
                Transform3D = transform
            };
            var block = new TextBlock()
            {
                Text = number.ToString(),
                FontSize = 64,
                Foreground = bordercolor,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                RenderTransformOrigin = new Point(0.5, 0.5)
            };

            if(fliptext)
            {
                block.RenderTransform = new ScaleTransform() { ScaleX = -1 };
            }

            newrectangle.Children.Add(block);
            number++;
            return newrectangle;

        }