示例#1
0
        /// <summary>
        /// When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class. 
        /// </summary>
        /// <param name="finalSize"></param>
        /// <returns></returns>
        protected override Size ArrangeOverride(Size finalSize)
        {
            //Arrange all children based on the geometric equations for the circle.
            if (Children.Count == 0)
                return finalSize;
            double _angle = 0.2;
            //Degrees converted to Radian by multiplying with PI/180
            double _incrementalAngularSpace = (180.0 / Children.Count) * (Math.PI / 180);
            //An approximate radii based on the avialable size , obviusly a better approach is needed here.
            double radiusX = finalSize.Width / 2.4;
            double radiusY = finalSize.Height / 2.4;
            foreach (UIElement elem in Children)
            {
                //Calculate the point on the circle for the element
                Point childPoint = new Point(Math.Cos(_angle) * radiusX, -Math.Sin(_angle) * radiusY);
                //Offsetting the point to the Avalable rectangular area which is FinalSize.
                Point actualChildPoint = new Point(finalSize.Width / 2 + childPoint.X - elem.DesiredSize.Width / 2, finalSize.Height / 2 + childPoint.Y - elem.DesiredSize.Height / 2);
                //Call Arrange method on the child element by giving the calculated point as the placementPoint.
                elem.Arrange(new Rect(actualChildPoint.X, actualChildPoint.Y, elem.DesiredSize.Width, elem.DesiredSize.Height));
                //Calculate the new _angle for the next element
                _angle += _incrementalAngularSpace;
            }

            return finalSize;
        }
        public void DrawImage(Point center, Size s, BitmapImage image)
        {
            Image img = new Image();
            img.Source = (ImageSource)image;

            int imageHeight = image.PixelHeight == 0 ? 320 : image.PixelWidth;
            int imageWidth = image.PixelWidth == 0 ? 180 : image.PixelWidth;

            ScaleTransform resizeTransform = new ScaleTransform();
            resizeTransform.ScaleX = (s.Width / imageHeight) * Canvas.Width;
            resizeTransform.ScaleY = (s.Height / imageWidth) * Canvas.Height;

            TranslateTransform posTransform = new TranslateTransform();
            posTransform.X = center.X * Canvas.Width;
            posTransform.Y = center.Y * Canvas.Height;

            TransformGroup transform = new TransformGroup();
            transform.Children.Add(resizeTransform);
            transform.Children.Add(posTransform);

            img.RenderTransform = transform;

            Canvas.Children.Add(img);

        }
示例#3
0
 protected override Size MeasureOverride(Size availableSize)
 {
     this.availableSize = availableSize;
     // Children[0] is the outer ScrollViewer
     this.Children[0].Measure(availableSize);
     return this.Children[0].DesiredSize;
 }
示例#4
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            // Get the collection of children
            UIElementCollection mychildren = Children;

            // Get total number of children
            int count = mychildren.Count;

            // Arrange children
            // We're only allowing 9 children in this panel.  More children will get a 0x0 layout slot.
            int i;
            for (i = 0; i < count; i++)
            {

                // Get (left, top) origin point for the element in the 3x3 block
                Point cellOrigin = GetOrigin(i, 12, new Size(50, 50));

                // Arrange child
                // Get desired height and width. This will not be larger than 100x100 as set in MeasureOverride.
              //  var cellViewModel = contentPresenter.DataContext as CellViewModel;
                double dw = mychildren[i].DesiredSize.Width;
                double dh = mychildren[i].DesiredSize.Height;

                mychildren[i].Arrange(new Rect(cellOrigin.X, cellOrigin.Y, dw, dh));
            }

            // Return final size of the panel
            return finalSize;
        }
示例#5
0
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            Point middle = new Point(arrangeSize.Width / 2, arrangeSize.Height / 2);
            UIElementCollection mychildren = Children;

            foreach (UIElement element in mychildren)
            {
                double x = 0.0;
                double y = 0.0;
                double left = GetLeft(element);
                if (!double.IsNaN(left))
                {
                    x = left;
                }

                double top = GetTop(element);
                if (!double.IsNaN(top))
                {
                    y = top;
                }

                element.Arrange(new Rect(new Point(middle.X + x, middle.Y + y), element.DesiredSize));
            }

            return arrangeSize;
        }
        protected override MaybeTask<IImageProvider> GetEffectInternalAsync(IImageProvider source, Size sourceSize, Size renderSize)
        {
            ((IImageConsumer)Effect).Source = source;
            ((SpotlightEffect)Effect).Position = new Windows.Foundation.Point(sourceSize.Width / 2, sourceSize.Height / 2);

            return new MaybeTask<IImageProvider>(Effect);
        }
示例#7
0
 /// <summary>
 /// Measure the size of this control: make it cover the full App window
 /// </summary>
 protected override Size MeasureOverride(Size availableSize)
 {
     Rect bounds = Window.Current.Bounds;
     availableSize = new Size(bounds.Width, bounds.Height);
     base.MeasureOverride(availableSize);
     return availableSize;
 }
        protected override Size ArrangeOverride(Size finalSize)
        {
            Clip = new RectangleGeometry { Rect = new Rect(0, 0, finalSize.Width, finalSize.Height) };

            double positionLeft = 0d;

            foreach (var item in Children)
            {
                if (item != null)
                {
                    Size desiredSize = item.DesiredSize;

                    if (!double.IsNaN(desiredSize.Width) && !double.IsNaN(desiredSize.Height))
                    {
                        var rect = new Rect(positionLeft, 0, desiredSize.Width, desiredSize.Height);
                        item.Arrange(rect);
                        item.RenderTransform = new TranslateTransform();
                        positionLeft += desiredSize.Width;
                    }
                }
            }

            _templateApplied = true;

            return finalSize;
        }
        private Size InternalMeasure(
            Size availableSize,
            Func<UIElement, Size, Size> childMesaureCallback,
            Func<Size, Size> finalSize) {

            double requiredHeight = 0;
            double requiredWidth = 0;

            var availableHeight = double.IsInfinity(availableSize.Height)
                                         ? Window.Current.Bounds.Height
                                         : availableSize.Height;
            var availableWidth = double.IsInfinity(availableSize.Width)
                                        ? Window.Current.Bounds.Width
                                        : availableSize.Width;

            foreach (var child in Children) {
                var childMeasure = childMesaureCallback(child, new Size(requiredWidth, requiredHeight));
                requiredHeight = childMeasure.Height;
                requiredWidth = childMeasure.Width;
            }

            requiredHeight = Math.Max(requiredHeight, 1);
            requiredWidth = Math.Max(requiredWidth, 1);

            scale = Math.Min(availableWidth / requiredWidth, availableHeight / requiredHeight);

            foreach (var child in Children) {
                child.Measure(new Size(availableWidth, availableHeight));
            }

            return finalSize(new Size(requiredWidth, requiredHeight));
        }
示例#10
0
        protected override Size MeasureOverride(Size availableSize)
        {
            var progress = this.Progress;
            if (progress != null)
            {
                if (!Double.IsInfinity(availableSize.Width))
                {
                    progress.Width = Math.Min(96, Math.Max(8, availableSize.Width * 0.5));
                }
                if (!Double.IsInfinity(availableSize.Height))
                {
                    progress.Height = Math.Min(96, Math.Max(8, availableSize.Height * 0.5));
                }
                base.MeasureOverride(availableSize);
                _currentSize = NormalizeSize(availableSize);
                return _currentSize;
            }

            var newSize = new Size(Math.Min(Int16.MaxValue, availableSize.Width), Math.Min(Int16.MaxValue, availableSize.Height));
            if (_isHttpSource && BitmapCache.GetSizeLevel(_currentSize) != BitmapCache.GetSizeLevel(newSize))
            {
                _currentSize = newSize;
                RefreshSourceUri(_currentUri);
            }
            return base.MeasureOverride(availableSize);
        }
示例#11
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            base.ArrangeOverride(finalSize);

            var children = Children.OfType<TextBlock>();
            var offset = (double)GetValue(HaloRing.OriginProperty) + AlignmentFactor(children);

            var parent = Parent as HaloRing;

            for (var i = 0; i < children.Count(); i++)
            {
                var slat = children.ElementAt(i);

                if (i > 0)
                {
                    offset += ArcAngle(slat) / 2;
                }

                slat.SetValue(
                    HaloRing.AngleProperty, offset
                );

                slat.SetValue(
                    HaloRing.OriginProperty, GetValue(HaloRing.OriginProperty)
                );

                offset += ArcAngle(slat) / 2;
            }

            return new Size(0, 0);
        }
        protected override MaybeTask<IImageProvider> GetEffectInternalAsync(IImageProvider source, Size sourceSize, Size renderSize)
        {
            m_linearGradient.StartPoint = new Point(m_startX, m_startY);
            m_linearGradient.EndPoint = new Point(m_endX, m_endY);

            return new MaybeTask<IImageProvider>(m_gradientImageSource);
        }
示例#13
0
        protected override Size MeasureOverride(Size availableSize)
        {
            availableSize = NormalizeSize(availableSize);

            double width = availableSize.Width / this.MaxItems;
            double height = width / this.AspectRatio;

            if (height < MinHeight)
            {
                height = MinHeight;
                width = height * this.AspectRatio;
            }

            if (height > MaxHeight)
            {
                height = MaxHeight;
                width = height * this.AspectRatio;
            }

            _panel.ItemWidth = Math.Round(width);
            _panel.ItemHeight = Math.Round(height);

            this.Position = -this.Index * width;

            return base.MeasureOverride(new Size(availableSize.Width, height));
        }
示例#14
0
 protected override Size ArrangeOverride(Size finalSize)
 {
     var r = new RectangleGeometry();
     r.Rect = new Rect(new Point(0, 0), finalSize);
     Clip = r;
     return base.ArrangeOverride(finalSize);
 }
 public ThumbnailRenderer(Size thumbnailSize, Action<IImageProcessor, SoftwareBitmap> thumbnailCompleteAction)
 {
     m_thumbnailSize = thumbnailSize;
     m_thumbnailCompleteAction = thumbnailCompleteAction;
     m_bitmapRenderer = new SoftwareBitmapRenderer();
     m_bitmapRenderer.Size = thumbnailSize;
 }
示例#16
0
        async void SaveTheForest()
        {
            var displayInformation = DisplayInformation.GetForCurrentView();
            var imageSize = new Size(ACTWIDTH, ACTHEIGHT);
            canvasOfAvaga.Measure(imageSize);
            canvasOfAvaga.UpdateLayout();
            canvasOfAvaga.Arrange(new Rect(0, 0, imageSize.Width, imageSize.Height));

            var renderTargetBitmap = new RenderTargetBitmap();
            await renderTargetBitmap.RenderAsync(canvasOfAvaga, Convert.ToInt32(imageSize.Width), Convert.ToInt32(imageSize.Height));
            //await renderTargetBitmap.RenderAsync(canvasOfAvaga, Convert.ToInt32(ACTWIDTH), Convert.ToInt32(ACTHEIGHT));

            var pixelBuffer = await renderTargetBitmap.GetPixelsAsync();
            var picker = new FileSavePicker();
            picker.FileTypeChoices.Add(".jpg",new[] {".jpg"});
            var file = picker.PickSaveFileAsync();
            //var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("D:\\Screen.jpg", CreationCollisionOption.ReplaceExisting);
            using (var fileStream = await (await picker.PickSaveFileAsync()).OpenAsync(FileAccessMode.ReadWrite))
            {
                var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, fileStream);

                encoder.SetPixelData(
                        BitmapPixelFormat.Bgra8,
                        BitmapAlphaMode.Ignore,
                        (uint)renderTargetBitmap.PixelWidth,
                        (uint)renderTargetBitmap.PixelHeight,
                        displayInformation.LogicalDpi,
                        displayInformation.LogicalDpi,
                        pixelBuffer.ToArray());

                await encoder.FlushAsync();
            }
        }
示例#17
0
        protected override Size MeasureOverride(Size availableSize)
        {
            // Just take up all of the width
            Size finalSize = new Size { Width = availableSize.Width };
            double x = 0;
            double rowHeight = 0d;
            foreach (var child in Children)
            {
                // Tell the child control to determine the size needed
                child.Measure(availableSize);

                x += child.DesiredSize.Width;
                if (x > availableSize.Width)
                {
                    // this item will start the next row
                    x = child.DesiredSize.Width;

                    // adjust the height of the panel
                    finalSize.Height += rowHeight;
                    rowHeight = child.DesiredSize.Height;
                }
                else
                {
                    // Get the tallest item
                    rowHeight = Math.Max(child.DesiredSize.Height, rowHeight);
                }
            }

            // Add the final height
            finalSize.Height += rowHeight;
            return finalSize;
        }
示例#18
0
        /// <summary>
        /// Provides the behavior for the Arrange pass of layout. Classes can override
        /// this method to define their own Arrange pass behavior.
        /// </summary>
        /// <param name="arrangeSize">
        /// The final area within the parent that this object should use to arrange itself
        /// and its children.
        /// </param>
        /// <returns></returns>
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            var finalRect = new Rect(
                0.0,
                0.0,
                arrangeSize.Width / _columns,
                arrangeSize.Height / _rows);
            var width = finalRect.Width;
            var num2 = arrangeSize.Width - 1.0;
            finalRect.X += finalRect.Width * this.FirstColumn;

            foreach (var element in Children)
            {
                element.Arrange(finalRect);

                if (element.Visibility != Visibility.Collapsed)
                {
                    finalRect.X += width;

                    if (finalRect.X >= num2)
                    {
                        finalRect.Y += finalRect.Height;
                        finalRect.X = 0.0;
                    }
                }
            }

            return arrangeSize;
        }
示例#19
0
        // Draw to the CanvasSwapChain.
        void DrawToSwapChain(Size size)
        {
            if (size.Width <= 0 || size.Height <= 0)
            {
                swapChain = null;
                swapChainPanel.SwapChain = null;
                return;
            }
            else if (swapChain == null)
            {
                swapChain = new CanvasSwapChain(canvasControl, size);
                swapChainPanel.SwapChain = swapChain;
            }
            else
            {
                swapChain.ResizeBuffers((float)size.Width, (float)size.Height, canvasControl.Dpi);
            }

            using (var ds = swapChain.CreateDrawingSession(Colors.Transparent))
            {
                Draw(ds, "Canvas\nSwap\nChain", size);
            }

            swapChain.Present();
        }
        public async Task GetNewFrameAndApplyEffect(IBuffer frameBuffer, Size frameSize)
        {
            if (_semaphore.WaitOne(500))
            {
                var scanlineByteSize = (uint)frameSize.Width * 4; // 4 bytes per pixel in BGRA888 mode
                var bitmap = new Bitmap(frameSize, ColorMode.Bgra8888, scanlineByteSize, frameBuffer);

                if (_filterEffect != null)
                {
                    var renderer = new BitmapRenderer(_filterEffect, bitmap);
                    await renderer.RenderAsync();
                }
                else if (_customEffect != null)
                {
                    var renderer = new BitmapRenderer(_customEffect, bitmap);
                    await renderer.RenderAsync();
                }
                else
                {
                    var renderer = new BitmapRenderer(_cameraPreviewImageSource, bitmap);
                    await renderer.RenderAsync();
                }

                _semaphore.Release();
            }
        }
示例#21
0
 public static WriteableBitmap Overlay(WriteableBitmap bmp, WriteableBitmap overlay, Point location)
 {
     var result = bmp.Clone();
     var size = new Size(overlay.PixelWidth, overlay.PixelHeight);
     result.Blit(new Rect(location, size), overlay, new Rect(new Point(0, 0), size), WriteableBitmapExtensions.BlendMode.Alpha);
     return result;
 }
示例#22
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            double width = widthColumns.Sum();
            double height = rowHeigh.Sum();
            if (width > finalSize.Width)
                for (int i = 0; i < widthColumns.Count; i++)
                    widthColumns[i] = widthColumns[i] * finalSize.Width / width;

            double xOffset = 0.0;
            double yOffset = 0.0;
            int row = 0;
            int column = 0;
            foreach (UIElement child in this.Children)
            {
                if (column > 0)
                    xOffset += widthColumns[column - 1];
                child.Arrange(new Rect(xOffset, yOffset, widthColumns[column], rowHeigh[row]));
                column++;
                if (widthColumns.Count != column)
                    continue;

                yOffset += rowHeigh[row];
                row++;
                column = 0;
                xOffset = 0;

            }
            return new Size(width, height);
        }
        protected override MaybeTask<IImageProvider> GetEffectInternalAsync(IImageProvider source, Size sourceSize, Size renderSize)
        {
            m_radialGradient.CenterPoint = new Point(m_centerX, m_centerY);
            m_radialGradient.EllipseRadius = new EllipseRadius(m_radiusX, m_radiusY);

            return new MaybeTask<IImageProvider>(m_gradientImageSource);
        }
示例#24
0
 protected override Size ArrangeOverride(Size finalSize)
 {
     this.finalSize = finalSize;
     // Children[0] is the outer ScrollViewer
     this.Children[0].Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
     return finalSize;
 }
示例#25
0
 public override void Arrange(Size finalSize)
 {
     base.Arrange(DesiredSize);
     // Call method to arrange the marker
     SetIndicatorTransforms();
     PositionMarker();
 }
示例#26
0
 /// <summary>
 /// Private contructor.
 /// </summary>
 private DataContext()
 {
     PreviewResolutionStream = new MemoryStream();
     FullResolutionStream = new MemoryStream();
     FullResolution = new Size(DefaultPreviewResolutionWidth, DefaultPreviewResolutionHeight);
     PreviewResolution = new Size(DefaultPreviewResolutionWidth, DefaultPreviewResolutionHeight);
 }
示例#27
0
        private async void ExecuteTakePictureCommand()
        {
            try
            {
                Busy = true;

                StorageFile file = null;

                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Media.Capture.CameraCaptureUI"))
                {
                    // Using Windows.Media.Capture.CameraCaptureUI API to capture a photo
                    CameraCaptureUI dialog = new CameraCaptureUI();
                    Size aspectRatio = new Size(16, 9);
                    dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;

                    file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
                }

                if (file != null)
                {
                    // Copy the file into local folder
                    await file.CopyAsync(ApplicationData.Current.LocalFolder, file.Name, NameCollisionOption.ReplaceExisting);
                    // Save in the ToDoItem
                    TodoItem.ImageUri = new Uri("ms-appdata:///local/" + file.Name);
                }
            }
            finally { Busy = false; }
        }
示例#28
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            var panel = ItemsPanelRoot as ItemsWrapGrid;
            if (panel != null)
            {
                if (MinItemWidth == 0)
                {
                    throw new ArgumentException("You need to set MinItemHeight and MinItemWidth to a value greater than 0");
                }

                var availableWidth = finalSize.Width - (Padding.Right + Padding.Left);

                var numColumns = Math.Floor(availableWidth / MinItemWidth);
                numColumns = numColumns == 0 ? 1 : numColumns;

                //Not used yet (for horizontal scrolling scenarios)
                //var numRows = Math.Ceiling(this.Items.Count / numColumns);

                var itemWidth = availableWidth / numColumns;

                panel.ItemWidth = itemWidth;
                panel.ItemHeight = 120;
            }

            return base.ArrangeOverride(finalSize);
        }
示例#29
0
        /// <summary>
        /// Calculates a good font size so the text will fit even on smaller phone screens.
        /// </summary>
        private static float GetFontSize(Size displaySize)
        {
            const float maxFontSize = 72;
            const float scaleFactor = 12;

            return Math.Min((float)displaySize.Width / scaleFactor, maxFontSize);
        }
示例#30
0
        void EnsureResources(ICanvasResourceCreatorWithDpi resourceCreator, Size targetSize)
        {
            if (resourceRealizationSize == targetSize && !needsResourceRecreation)
                return;

            float canvasWidth = (float)targetSize.Width;
            float canvasHeight = (float)targetSize.Height;
            sizeDim = Math.Min(canvasWidth, canvasHeight);

            if (!defaultFontSizeSet)
            {
                CurrentFontSize = sizeDim / 1.3f;
                CurrentFontSize = Math.Max((float)fontSizeSlider.Minimum, CurrentFontSize);
                CurrentFontSize = Math.Min((float)fontSizeSlider.Maximum, CurrentFontSize);
                fontSizeSlider.Value = CurrentFontSize;
                defaultFontSizeSet = true;
            }

            if (textLayout != null) 
                textLayout.Dispose();
            textLayout = CreateTextLayout(resourceCreator, canvasWidth, canvasHeight);

            if (!UniformStyle)
            {
                textLayout.SetFontSize(0, 1, CurrentUppercaseFontSize);
                textLayout.SetFontFamily(0, 1, uppercaseFontPicker.CurrentFontFamily);

                textLayout.SetFontSize(1, 2, CurrentLowercaseFontSize);
                textLayout.SetFontFamily(1, 2, lowercaseFontPicker.CurrentFontFamily);
            }

            needsResourceRecreation = false;
            resourceRealizationSize = targetSize;
        }
示例#31
0
        protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize)
        {
            if (Element == null)
            {
                return(finalSize);
            }

            Element.IsInNativeLayout = true;

            Control?.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));

            Element.IsInNativeLayout = false;

            return(finalSize);
        }
示例#32
0
        public void When_Border_Has_Fixed_Size()
        {
            var fixedSize = new Windows.Foundation.Size(100, 100);

            var SUT = new Border()
            {
                Width  = fixedSize.Width,
                Height = fixedSize.Height
            };

            SUT.Measure(new Windows.Foundation.Size(500, 500));
            var measuredSize = SUT.DesiredSize;

            Assert.AreEqual(fixedSize, measuredSize);
        }
示例#33
0
        public virtual SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
        {
            if (Children.Count == 0)
            {
                return(new SizeRequest());
            }

            var            constraint = new Windows.Foundation.Size(widthConstraint, heightConstraint);
            TNativeElement child      = Control;

            child.Measure(constraint);
            var result = new Size(Math.Ceiling(child.DesiredSize.Width), Math.Ceiling(child.DesiredSize.Height));

            return(new SizeRequest(result));
        }
示例#34
0
        protected override Windows.Foundation.Size MeasureOverride(Windows.Foundation.Size availableSize)
        {
            if (Element == null)
            {
                return(new Windows.Foundation.Size(0, 0));
            }

            double width  = Math.Max(0, Element.Width);
            double height = Math.Max(0, Element.Height);
            var    result = new Windows.Foundation.Size(width, height);

            Control?.Measure(result);

            return(result);
        }
示例#35
0
        private void HandleSizeChanged(object sender, Windows.Foundation.Size newSize)
        {
            var bounds = newSize;

            // Only apply SwapChain resize when effective orientation is matching current orientation
            // TODO: We might want to handle borders if excplitiely asked in game user settings asset (fixed aspect ratio)
            var currentOrientation  = ApplicationView.GetForCurrentView().Orientation;
            var rotationPreferences = DisplayInformation.AutoRotationPreferences;

            // If user clicked only portraits or only landscapes mode (or nothing at all?), let's check against current orientation if it is matching
            bool isOrientationMatchingPreferences =
                (currentOrientation == ApplicationViewOrientation.Portrait && (rotationPreferences & PortraitOrientations) != 0) ||
                (currentOrientation == ApplicationViewOrientation.Landscape && (rotationPreferences & LandscapeOrientations) != 0);

            if (!isOrientationMatchingPreferences && bounds.Width > 0 && bounds.Height > 0 && currentWidth > 0 && currentHeight > 0)
            {
                // Need to add border (display forces us to have another orientation, i.e. a portrait-only game running on Windows Store computer screen)
                double panelWidth;
                double panelHeight;
                panelWidth  = bounds.Width;
                panelHeight = bounds.Height;
                var panelRatio   = panelWidth / panelHeight;
                var currentRatio = currentWidth / currentHeight;

                if (panelRatio < currentRatio)
                {
                    panelWidth  = bounds.Width;
                    panelHeight = (int)(currentHeight * bounds.Width / currentWidth);
                }
                else
                {
                    panelHeight = bounds.Height;
                    panelWidth  = (int)(currentWidth * bounds.Height / currentHeight);
                }

                if (swapChainPanel.Width != panelWidth || swapChainPanel.Height != panelHeight)
                {
                    // Center the panel
                    swapChainPanel.HorizontalAlignment = HorizontalAlignment.Center;
                    swapChainPanel.VerticalAlignment   = VerticalAlignment.Center;

                    swapChainPanel.Width  = panelWidth;
                    swapChainPanel.Height = panelHeight;
                }
            }

            OnClientSizeChanged(sender, EventArgs.Empty);
        }
示例#36
0
        internal override void Paint(Graphics gs, Windows.Foundation.Size avilableSize)
        {
            List <Windows.UI.Xaml.Shapes.Line> lines = this.GetLines(avilableSize);

            if (lines != null)
            {
                using (List <Windows.UI.Xaml.Shapes.Line> .Enumerator enumerator = lines.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Windows.UI.Xaml.Shapes.Line item = enumerator.Current;
                        base.TransFormLine(item, avilableSize);
                        double num1   = item.X1;
                        double num3   = item.Y1;
                        double width  = Math.Abs((double)(item.X2 - item.X1));
                        double height = Math.Abs((double)(item.Y2 - item.Y1));
                        if ((width >= 0.0) && (height >= 0.0))
                        {
                            gs.SaveState();
                            gs.MoveTo(new Windows.Foundation.Point(item.X1, item.Y1));
                            gs.LineTo(new Windows.Foundation.Point(item.X2, item.Y2));
                            gs.ApplyFillEffect(item.Stroke, new Windows.Foundation.Rect(item.X1, item.Y1, width, height), true, false);
                            gs.SetLineWidth(item.StrokeThickness);
                            gs.Stroke();
                            gs.RestoreState();
                        }
                    }
                }
            }
            List <DrawRectInfo> drawRects = base.GetDrawRects(avilableSize);

            if (drawRects != null)
            {
                foreach (DrawRectInfo info in drawRects)
                {
                    if (((info.brush != null) && (info.rect.Height > 0.0)) && (info.rect.Height > 0.0))
                    {
                        gs.SaveState();
                        Windows.Foundation.Rect rect = base.TransFormRect(info.rect, avilableSize);
                        gs.Translate(rect.Left + (rect.Width / 2.0), rect.Top + (rect.Height / 2.0));
                        gs.Rotate(-45.0);
                        rect = new Windows.Foundation.Rect(-rect.Width / 2.0, -rect.Height / 2.0, rect.Width, rect.Height);
                        gs.FillRectangle(rect, info.brush);
                        gs.RestoreState();
                    }
                }
            }
        }
        /// <summary>
        /// Provides the behavior for the Arrange pass of layout. Classes can override this method to define their own Arrange pass behavior.
        /// </summary>
        /// <param name="finalSize">The final area within the parent that this object should use to arrange itself and its children.</param>
        /// <returns>
        /// The actual size that is used after the element is arranged in layout.
        /// </returns>
        protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize)
        {
            foreach (var child in this.Children)
            {
                if (child.DesiredSize.IsEmpty)
                {
                    child.Arrange(new Rect(0, 0, child.DesiredSize.Width, child.DesiredSize.Height));
                }
                else
                {
                    child.Arrange(new Rect(Math.Round((finalSize.Width - child.DesiredSize.Width) / 2.0), Math.Round((finalSize.Height - child.DesiredSize.Height) / 2.0), child.DesiredSize.Width, child.DesiredSize.Height));
                }
            }

            return(base.ArrangeOverride(finalSize));
        }
示例#38
0
        /// <summary>
        /// Creates the new page.
        /// </summary>
        /// <returns></returns>
        public GcPageBlock CreateNewPage()
        {
            GcPageBlock block = new GcPageBlock();

            Windows.Foundation.Size pageSize = Utilities.GetPageSize(this.Report.PaperSize, this.Report.Orientation);
            block.X      = 0.0;
            block.Y      = 0.0;
            block.Width  = pageSize.Width;
            block.Height = pageSize.Height;
            GcPageRectangles rectangles = new GcPageRectangles {
                CropRectangle = this.pageRects.CropRectangle
            };

            block.Rectangles = rectangles;
            return(block);
        }
示例#39
0
        /// <summary>
        /// Gets the height of the item.
        /// </summary>
        /// <param name="availableSize">The available size.</param>
        /// <param name="index">The index.</param>
        /// <returns></returns>
        public override double GetItemHeight(Windows.Foundation.Size availableSize, int index)
        {
            double?nullable = base.CachedValues[index];
            double num      = nullable.HasValue ? ((double)nullable.GetValueOrDefault()) : 0.0;

            if (num == 0.0)
            {
                return(0.0);
            }
            Windows.Foundation.Size canvasSize = base.GetCanvasSize(availableSize);
            if (num >= 0.0)
            {
                return(canvasSize.Height / 2.0);
            }
            return(-canvasSize.Height / 2.0);
        }
示例#40
0
 /// <summary>
 /// Creates the axis line.
 /// </summary>
 /// <param name="avalibleSize">The available size.</param>
 /// <returns></returns>
 public Windows.UI.Xaml.Shapes.Line CreateAxisLine(Windows.Foundation.Size avalibleSize)
 {
     if (this.SparklineInfo.Setting.DisplayXAxis && this.HasAxis)
     {
         Windows.UI.Xaml.Shapes.Line line = new Windows.UI.Xaml.Shapes.Line();
         line.X1              = this.LeftSpace;
         line.X2              = avalibleSize.Width - this.RightSpace;
         line.Y1              = this.GetAxisY(avalibleSize);
         line.Y2              = line.Y1;
         line.Stroke          = new SolidColorBrush(this.SparklineInfo.Setting.AxisColor);
         line.StrokeThickness = 1.0;
         Canvas.SetZIndex(line, this.AxisZIndex);
         return(line);
     }
     return(null);
 }
示例#41
0
        /// <summary>
        /// Provides the behavior for the Arrange pass of layout. Classes can override
        /// this method to define their own Arrange pass behavior.
        /// </summary>
        /// <param name="finalSize">The final area within the parent that this object should
        /// use to arrange itself and its children.</param>
        /// <returns>
        /// The actual size that is used after the element is arranged in layout.
        /// </returns>
        protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize)
        {
            foreach (FrameworkElement child in this.Children)
            {
                var x = Canvas.GetLeft(child);
                var y = Canvas.GetTop(child);

                var rect = new Rect(new Point(x, y), new Size(finalSize.Width, child.DesiredSize.Height));

                child.Width = rect.Width;

                child.Arrange(rect);
            }

            return(finalSize);
        }
示例#42
0
        void MeasureLines(Windows.Foundation.Size availableSize)
        {
            LineSparklineViewInfo sparklineViewInfo = base.SparklineViewInfo as LineSparklineViewInfo;

            if (sparklineViewInfo != null)
            {
                sparklineViewInfo.MeasurelinePos(availableSize);
            }
            if ((sparklineViewInfo.LinePos != null) && (sparklineViewInfo.LinePos.Count > 0))
            {
                if (this.lines == null)
                {
                    this.lines = new List <Windows.UI.Xaml.Shapes.Line>();
                }
                for (int i = 0; i < sparklineViewInfo.LinePos.Count; i++)
                {
                    Windows.UI.Xaml.Shapes.Line line;
                    Windows.Foundation.Point    p1;
                    Windows.Foundation.Point    p2;
                    Tuple <Windows.Foundation.Point, Windows.Foundation.Point> tuple = sparklineViewInfo.LinePos[i];
                    if (tuple != null)
                    {
                        line = null;
                        if (i >= this.lines.Count)
                        {
                            line = new Windows.UI.Xaml.Shapes.Line();
                            line.StrokeStartLineCap = PenLineCap.Round;
                            line.StrokeEndLineCap   = PenLineCap.Round;
                            line.Stroke             = new SolidColorBrush(this.SparklineInfo.Setting.SeriesColor);
                            double lineWeight = this.GetLineWeight();
                            line.StrokeThickness = lineWeight;
                            this.lines.Add(line);
                        }
                        else
                        {
                            line = this.lines[i];
                        }
                        p1      = tuple.Item1;
                        p2      = tuple.Item2;
                        line.X1 = p1.X;
                        line.X2 = p2.X;
                        line.Y1 = p1.Y;
                        line.Y2 = p2.Y;
                    }
                }
            }
        }
示例#43
0
        /// <summary>
        /// Updates the size of the image source (drawable, bitmap, etc.)
        /// </summary>
        /// <param name="size">size of the image source (in physical pixels)</param>
        /// <param name="isLogicalPixels">indicates that the size of the image source is in logical pixels (this is the case when the source is an URI)</param>
        private void UpdateSourceImageSize(Windows.Foundation.Size size, bool isLogicalPixels = false)
        {
            if (_sourceImageSize == size)
            {
                return;
            }

            _sourceImageSize = isLogicalPixels
                                ? size // is logical size already, no conversion needed
                                : size.PhysicalToLogicalPixels();

            _sourceImageScale = isLogicalPixels
                                ? ViewHelper.Scale // the size of the image source (usually a bitmap from UniversalImageLoader) is in logical pixels, we need to scale it when Stretch.None
                                : 1;               // the size of the image source (usually a drawable/resource) is already physical pixels, no need to scale it

            UpdateMatrix(_lastLayoutSize);
        }
示例#44
0
        public static CGSize Measure(this IFrameworkElement element, _Size availableSize)
        {
#if XAMARIN_IOS || __MACOS__
            return(((View)element).SizeThatFits(new CoreGraphics.CGSize(availableSize.Width, availableSize.Height)));
#elif XAMARIN_ANDROID
            var widthSpec  = ViewHelper.SpecFromLogicalSize(availableSize.Width);
            var heightSpec = ViewHelper.SpecFromLogicalSize(availableSize.Height);

            var view = ((View)element);
            view.Measure(widthSpec, heightSpec);

            return(Uno.UI.Controls.BindableView.GetNativeMeasuredDimensionsFast(view)
                   .PhysicalToLogicalPixels());
#else
            return(default(CGSize));
#endif
        }
示例#45
0
 public static CGSize Measure(this View element, _Size availableSize)
 {
     if (element is NSControl nsControl)
     {
         return(nsControl.SizeThatFits(new CoreGraphics.CGSize(availableSize.Width, availableSize.Height)));
     }
     else if (element is FrameworkElement fe)
     {
         fe.Measure(new Size(availableSize.Width, availableSize.Height));
         var desiredSize = fe.DesiredSize;
         return(new CGSize(desiredSize.Width, desiredSize.Height));
     }
     else
     {
         throw new NotSupportedException($"Unsupported measure for {element}");
     }
 }
        SizeRequest IVisualElementRenderer.GetDesiredSize(double widthConstraint, double heightConstraint)
        {
            var constraint = new Windows.Foundation.Size(widthConstraint, heightConstraint);

            double oldWidth  = Width;
            double oldHeight = Height;

            Height = double.NaN;
            Width  = double.NaN;

            Measure(constraint);
            var result = new Size(Math.Ceiling(DesiredSize.Width), Math.Ceiling(DesiredSize.Height));

            Width  = oldWidth;
            Height = oldHeight;

            return(new SizeRequest(result));
        }
示例#47
0
        public void When_Border_Has_Margin()
        {
            var fixedSize = new Windows.Foundation.Size(100, 120);
            var margin    = new Thickness(10, 20, 30, 40);
            var totalSize = new Windows.Foundation.Size(fixedSize.Width + margin.Left + margin.Right, fixedSize.Height + margin.Top + margin.Bottom);

            var SUT = new Border()
            {
                Width  = fixedSize.Width,
                Height = fixedSize.Height,
                Margin = margin,
            };

            SUT.Measure(new Windows.Foundation.Size(500, 500));
            var measuredSize = SUT.DesiredSize;

            Assert.AreEqual(totalSize, measuredSize);
        }
示例#48
0
        public virtual wf.Size GetPreferredSize(wf.Size constraint)
        {
            var size = preferredSize;

            if (double.IsNaN(size.Width) || double.IsNaN(size.Height))
            {
                ContainerControl.Measure(constraint);
                var desired = ContainerControl.DesiredSize;
                if (double.IsNaN(size.Width))
                {
                    size.Width = Math.Max(desired.Width, DefaultSize.Width);
                }
                if (double.IsNaN(size.Height))
                {
                    size.Height = Math.Max(desired.Height, DefaultSize.Height);
                }
            }
            return(size);
        }
示例#49
0
        internal List <DrawRectInfo> GetDrawRects(Windows.Foundation.Size availableSize)
        {
            if (double.IsInfinity(availableSize.Width) || double.IsInfinity(availableSize.Height))
            {
                return(null);
            }
            List <DrawRectInfo> list = new List <DrawRectInfo>();
            double actualMinValue    = this._viewInfo.GetActualMinValue();
            double actualMaxValue    = this._viewInfo.GetActualMaxValue();

            foreach (int num4 in this._viewInfo.CachedIndexMaping)
            {
                Brush  brush;
                double?cachedValue = this._viewInfo.GetCachedValue(num4);
                if (cachedValue.HasValue)
                {
                    double?nullable2 = cachedValue;
                    double num5      = actualMinValue;
                    if (!((((double)nullable2.GetValueOrDefault()) < num5) && nullable2.HasValue))
                    {
                        double?nullable3 = cachedValue;
                        double num6      = actualMaxValue;
                        if (!((((double)nullable3.GetValueOrDefault()) > num6) && nullable3.HasValue))
                        {
                            goto Label_00C0;
                        }
                    }
                    if (!this.DrawDataPointsBeyondMaxAndMin())
                    {
                        continue;
                    }
                }
Label_00C0:
                brush = this.GetFillBrush(num4, availableSize);
                Windows.Foundation.Rect dataPointPosition = this._viewInfo.GetDataPointPosition(num4, availableSize);
                DrawRectInfo            info = new DrawRectInfo {
                    brush = brush,
                    rect  = dataPointPosition
                };
                list.Add(info);
            }
            return(list);
        }
示例#50
0
        private Size MeasureOverrideHorizontal(Size availableSize)
        {
            Size childAvailableSize = new Windows.Foundation.Size(double.PositiveInfinity, BlockSize);

            int blockCount = 0;

            if (Children.Count > 0)
            {
                blockCount = 1;
            }

            var remainingSpace = availableSize.Width;

            foreach (var item in Children)
            {
                item.Measure(childAvailableSize);
                if (item.DesiredSize.Width > remainingSpace)
                {
                    if (remainingSpace != availableSize.Width)
                    {
                        remainingSpace = availableSize.Width;
                        blockCount++;
                    }
                }

                remainingSpace -= item.DesiredSize.Width;
            }

            Size desiredSize = new Size();

            if (blockCount > 0)
            {
                desiredSize.Height = (blockCount * BlockSize) + ((blockCount - 1) * BlockSpacing);
            }
            else
            {
                desiredSize.Height = 0;
            }
            desiredSize.Width = availableSize.Width;

            return(desiredSize);
        }
示例#51
0
            protected override Windows.Foundation.Size MeasureOverride(Windows.Foundation.Size availableSize)
            {
                Size request = _view.Measure(availableSize.Width, availableSize.Height, MeasureFlags.IncludeMargins).Request;

                Windows.Foundation.Size result;
                if (_view.HorizontalOptions.Alignment == LayoutAlignment.Fill && !double.IsInfinity(availableSize.Width) && availableSize.Width != 0)
                {
                    result = new Windows.Foundation.Size(availableSize.Width, request.Height);
                }
                else
                {
                    result = new Windows.Foundation.Size(request.Width, request.Height);
                }

                _view.Layout(new Rectangle(0, 0, result.Width, result.Height));

                FrameworkElement?.Measure(availableSize);

                return(result);
            }
示例#52
0
        /// <summary>
        /// Gets the preferred size.
        /// </summary>
        /// <param name="context">The context</param>
        /// <returns></returns>
        internal override Windows.Foundation.Size GetPreferredSize(GcReportContext context)
        {
            int num = base.width - this.alignment.TextIndent;

            num = Math.Max(0, num);
            if (this.padding.Horizontal > 0)
            {
                num -= this.padding.Horizontal;
            }
            if (num < 0)
            {
                num = 0;
            }
            Windows.Foundation.Size size = Utilities.MeasureStringByAlignment(context, this.Text, base.font, this.alignment, num);
            if (!size.IsEmpty && (this.padding.Vertical > 0))
            {
                size.Height += this.padding.Vertical;
            }
            return(size);
        }
示例#53
0
 protected override Windows.Foundation.Size MeasureOverride(Windows.Foundation.Size availableSize)
 {
     if (m_Content != null)
     {
         if (((int)Direction) % 180 == 90)
         {
             m_Content.Measure(new Windows.Foundation.Size(availableSize.Height, availableSize.Width));
             return(new Size(m_Content.DesiredSize.Height, m_Content.DesiredSize.Width));
         }
         else
         {
             m_Content.Measure(availableSize);
             return(m_Content.DesiredSize);
         }
     }
     else
     {
         return(base.MeasureOverride(availableSize));
     }
 }
示例#54
0
            protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize)
            {
                _view.IsInNativeLayout = true;
                Layout.LayoutChildIntoBoundingRegion(_view, new Rectangle(0, 0, finalSize.Width, finalSize.Height));

                if (_view.Width <= 0 || _view.Height <= 0)
                {
                    // Hide Panel when size _view is empty.
                    // It is necessary that this element does not overlap other elements when it should be hidden.
                    Opacity = 0;
                }
                else
                {
                    Opacity = 1;
                    FrameworkElement?.Arrange(new Rect(_view.X, _view.Y, _view.Width, _view.Height));
                }
                _view.IsInNativeLayout = false;

                return(finalSize);
            }
示例#55
0
        double CalcItemWidth(Windows.Foundation.Size availableSize)
        {
            double        num  = this.GetMinDatetime().ToOADate();
            double        num2 = this.GetMaxDatetime().ToOADate();
            List <double> list = new List <double>();

            for (int i = 0; i < this.CachedIndexMaping.Count; i++)
            {
                int      num4     = this.CachedIndexMaping[i];
                DateTime?nullable = this.CachedDatetimes[num4];
                if (nullable.HasValue && this.CachedDatetimesVisible[num4] && (nullable.Value != DateTime.MinValue))
                {
                    double num5 = nullable.Value.ToOADate();
                    list.Add(num5);
                }
            }
            list.Sort();
            if ((list.Count <= 1) || (num == num2))
            {
                return(((availableSize.Width - this.LeftSpace) - this.RightSpace) / 2.0);
            }
            double maxValue = double.MaxValue;
            double num7     = 0.0;

            for (int j = 1; j < list.Count; j++)
            {
                double num10 = list[j] - list[j - 1];
                if ((num10 < maxValue) && (num10 > 0.0))
                {
                    maxValue = num10;
                }
                num7 += num10;
            }
            double num11 = ((((availableSize.Width - this.LeftSpace) - this.RightSpace) * maxValue) / num7) / 2.0;

            if (num11 < 2.0)
            {
                num11 = 2.0;
            }
            return(num11);
        }
示例#56
0
文件: GcSection.cs 项目: Daoting/dt
        /// <summary>
        /// Gets the range.
        /// </summary>
        /// <param name="context">The context</param>
        /// <param name="x">The x</param>
        /// <param name="y">The y</param>
        /// <param name="width">The width</param>
        /// <param name="high">The height</param>
        /// <param name="blocks">The blocks</param>
        /// <param name="allSize">All sizes</param>
        /// <param name="buildInControlState">State of the build in control</param>
        /// <param name="horizontal">If set to <c>true</c>, [horizontal]</param>
        /// <param name="continuePage">If set to <c>true</c>, [continue page]</param>
        /// <returns></returns>
        internal virtual GcRangeBlock GetRange(GcReportContext context, int x, int y, int width, int high, List <GcBlock> blocks, Windows.Foundation.Size allSize, object buildInControlState, bool horizontal, bool continuePage)
        {
            List <GcRangeBlock> list = this.GetBuildInControlRange(context, x, y, width, high, buildInControlState, horizontal, continuePage);

            Windows.Foundation.Size size = allSize;
            Windows.Foundation.Rect rect = new Windows.Foundation.Rect(0.0, 0.0, size.Width, size.Height);
            if ((list != null) && (list.Count > 0))
            {
                foreach (GcRangeBlock block in list)
                {
                    rect.Union(new Windows.Foundation.Rect(block.X, block.Y, block.Width, block.Height));
                }
            }
            Windows.Foundation.Rect rect2 = new Windows.Foundation.Rect((double)x, (double)y, (double)width, (double)high);
            if (!IsIntersect(rect, rect2))
            {
                return(new GcRangeBlock(0.0, 0.0, 0.0, 0.0));
            }
            rect.Intersect(rect2);
            GcRangeBlock block2 = new GcRangeBlock(0.0, 0.0, (double)((int)Math.Ceiling(rect.Width)), (double)((int)Math.Ceiling(rect.Height)))
            {
                OffsetX = (int)rect.X,
                OffsetY = (int)rect.Y
            };

            if ((list != null) && (list.Count > 0))
            {
                foreach (GcRangeBlock block3 in list)
                {
                    block2.Blocks.Add(block3);
                }
            }
            foreach (GcBlock block4 in blocks)
            {
                if (block4.IntersectWith((double)((int)rect.X), (double)((int)rect.Y), (double)((int)rect.Width), (double)((int)rect.Height)))
                {
                    block2.Blocks.Add(block4.Clone());
                }
            }
            return(block2);
        }
示例#57
0
        public override wf.Size GetPreferredSize(wf.Size constraint)
        {
            var size = new wf.Size();

            foreach (var control in Widget.Controls)
            {
                var container     = control.GetContainerControl();
                var preferredSize = control.GetPreferredSize(constraint);
                var left          = swc.Canvas.GetLeft(container) + preferredSize.Width;
                var top           = swc.Canvas.GetTop(container) + preferredSize.Height;
                if (size.Width < left)
                {
                    size.Width = left;
                }
                if (size.Height < top)
                {
                    size.Height = top;
                }
            }
            return(size);
        }
示例#58
0
        /// <summary>
        /// Gets the height of the visible item.
        /// </summary>
        /// <param name="availableSize">The available size.</param>
        /// <param name="index">The index.</param>
        /// <returns></returns>
        public override double GetItemVisibleHeight(Windows.Foundation.Size availableSize, int index)
        {
            double itemVisibleHeight = base.GetItemVisibleHeight(availableSize, index);

            if ((itemVisibleHeight <= -2.0) || (itemVisibleHeight >= 2.0))
            {
                return(itemVisibleHeight);
            }
            double?cachedValue = this.GetCachedValue(index);
            double num2        = cachedValue.HasValue ? ((double)cachedValue.GetValueOrDefault()) : 0.0;

            if (num2 == 0.0)
            {
                return(itemVisibleHeight);
            }
            if (num2 > 0.0)
            {
                return(itemVisibleHeight + 2.0);
            }
            return(itemVisibleHeight - 2.0);
        }
示例#59
0
        /// <summary>
        /// Gets the height of the item.
        /// </summary>
        /// <param name="availableSize">The available size.</param>
        /// <param name="index">The index.</param>
        /// <returns></returns>
        public virtual double GetItemHeight(Windows.Foundation.Size availableSize, int index)
        {
            Windows.Foundation.Size canvasSize = this.GetCanvasSize(availableSize);
            double actualMaxValue = this.GetActualMaxValue();
            double actualMinValue = this.GetActualMinValue();
            double num3           = actualMaxValue - actualMinValue;

            if (actualMaxValue == actualMinValue)
            {
                if (actualMaxValue == 0.0)
                {
                    return(0.0);
                }
                num3 = Math.Abs(actualMaxValue);
            }
            double?cachedValue = this.GetCachedValue(index);
            double num4        = cachedValue.HasValue ? ((double)cachedValue.GetValueOrDefault()) : 0.0;
            double num5        = canvasSize.Height / num3;

            return(num4 * num5);
        }
示例#60
0
        /// <summary>
        /// Called in the arrange pass of the layout system.
        /// </summary>
        /// <param name="finalSize">The final size that was given by the layout system.</param>
        /// <returns>The final size of the panel.</returns>
        protected override Windows.Foundation.Size ArrangeOverride(Windows.Foundation.Size finalSize)
        {
            this.Clip = new RectangleGeometry()
            {
                Rect = new Windows.Foundation.Rect(0, 0, finalSize.Width, finalSize.Height)
            };

            if (this.isAnimationUpdateScheduled)
            {
                this.CommandService.ExecuteCommand(CommandId.GenerateAnimations, this.GetAnimations());
                this.isAnimationUpdateScheduled = false;
            }

            var swipeAreaLeft = this.DrawerLocation == DrawerLocation.Left ? 0 : finalSize.Width - this.swipeAreaElement.Width;
            var swipeAreaTop  = this.DrawerLocation == DrawerLocation.Top ? 0 : finalSize.Height - this.swipeAreaElement.Height;

            Canvas.SetLeft(this.swipeAreaElement, swipeAreaLeft);
            Canvas.SetTop(this.swipeAreaElement, swipeAreaTop);

            return(base.ArrangeOverride(finalSize));
        }