示例#1
0
 private void ThumbDragStarted(object sender, DragStartedEventArgs e)
 {
     if (sender is Thumb thumb)
     {
         var resizeHandle = (ResizeHandlePosition)Enum.Parse(typeof(ResizeHandlePosition), (string)thumb.Tag);
         ResizeStarted?.Invoke(this, new ResizeStartedEventArgs(resizeHandle));
     }
 }
示例#2
0
        private Thumb BuildAdornerCorner(Cursor cursor, DragDeltaEventHandler dragHandler)
        {
            var thumb = new Thumb();

            // TODO: this thumb should be styled to look like a dotted triangle,
            // similar to the one you can see on the bottom right corner of
            // Internet Explorer window
            thumb.Cursor       = cursor;
            thumb.Height       = thumb.Width = 10;
            thumb.Opacity      = 0.40;
            thumb.Background   = new SolidColorBrush(Colors.MediumBlue);
            thumb.DragDelta   += dragHandler;
            thumb.DragStarted += (s, e) =>
            {
                ResizeStarted?.Invoke(this, e);
            };
            thumb.DragCompleted += (s, e) =>
            {
                ResizeCompleted?.Invoke(this, e);
            };
            _visualChildren.Add(thumb);
            return(thumb);
        }