Ejemplo n.º 1
0
        internal static bool BeginDrag(UIElement container, IWindow topLevelWindow, MouseButtonEventArgs e)
        {
            UIElement     element = e.OriginalSource as UIElement;
            WindowHotspot hotspot = WindowHotspot.None;

            while (element != null && element != container)
            {
                hotspot = GetHotspot(element);
                if (hotspot != WindowHotspot.None)
                {
                    break;
                }

                element = VisualTreeHelper.GetParent(element) as UIElement;
            }

            if (hotspot == WindowHotspot.None)
            {
                return(false);
            }

            if (e.ClickCount == 1)
            {
                DragHandler.Default.BeginDrag(topLevelWindow, element, e);
                e.Handled = true;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
            public void BeginDrag(IWindow window, UIElement source, MouseEventArgs e)
            {
                _window  = window;
                _hotspot = WindowControl.GetHotspot(source);

                Window.UpdateLayout();
                _lastWindowBounds   = window.ActualBounds;
                _originWindowBounds = window.Bounds;
                DragDetect(source, e);
            }
Ejemplo n.º 3
0
 /// <summary>Sets the value of <see cref="P:DevZest.Windows.WindowControl.Hotspot"/> attached property for a given dependency object.</summary>
 /// <param name="element">The element to which the property value is written.</param>
 /// <param name="value">The value of <see cref="P:DevZest.Windows.WindowControl.Hotspot"/> attached property.</param>
 public static void SetHotspot(DependencyObject element, WindowHotspot value)
 {
     element.SetValue(HotspotProperty, value);
 }