Esempio n. 1
0
        // Handler for resizing from the bottom-right.
        void HandleBottom(object sender, DragDeltaEventArgs args)
        {
            FrameworkElement adornedElement = this.AdornedElement as FrameworkElement;
            Thumb            hitThumb       = sender as Thumb;

            if (adornedElement == null || hitThumb == null)
            {
                return;
            }
            FrameworkElement parentElement = adornedElement.Parent as FrameworkElement;

            // Ensure that the Width and Height are properly initialized after the resize.
            EnforceSize(adornedElement);

            var heightChangePixels = args.VerticalChange;

            var tileChange = (int)(heightChangePixels / Screen.Tileset.TileSize);
            var newHeight  = Screen.Height + tileChange;

            if (newHeight != Screen.Height && newHeight > 0)
            {
                Screen.Resize(Screen.Width, newHeight);
                InvalidateMeasure();
                InvalidateVisual();
            }
        }