Exemplo n.º 1
0
 private void onCanvasAttached()
 {
     Mouse.AddPreviewMouseDownHandler(canvas, OnMouseDown);
     Mouse.AddPreviewMouseMoveHandler(canvas, OnMouseMove);
     Mouse.AddPreviewMouseUpHandler(canvas, OnMouseUp);
     Mouse.AddPreviewMouseWheelHandler(canvas, OnMouseWheel);
 }
Exemplo n.º 2
0
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            //Correctly rotate the handle for vertical movement
            if (Orientation == Orientation.VerticalMovement)
            {
                gradientRotator.Angle = 0;
            }

            if (Orientation == Orientation.BiDimentionalMovement)
            {
                //No handle visible in BiDim case
                theBorder.Background = new SolidColorBrush(Colors.Blue);
            }

            //Don't attach events during design time
            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            var mainWindow = Application.Current.Windows.OfType <Window>().FirstOrDefault();

            Mouse.AddPreviewMouseDownHandler(this, OnLocalMouseDown);
            Mouse.AddMouseLeaveHandler(this, OnLocalMouseLeave);
            Mouse.AddMouseEnterHandler(this, OnLocalMouseEnter);
            Mouse.AddPreviewMouseMoveHandler(mainWindow, OnGlobalMouseMove);
            Mouse.AddPreviewMouseUpHandler(mainWindow, OnGlobalMouseUp);
        }
Exemplo n.º 3
0
        public override void OnPlotterAttached(Plotter plotter)
        {
            base.OnPlotterAttached(plotter);

            Mouse.AddPreviewMouseDownHandler(Parent, OnMouseDown);
            Mouse.AddPreviewMouseMoveHandler(Parent, OnMouseMove);
            Mouse.AddPreviewMouseUpHandler(Parent, OnMouseUp);
            Mouse.AddPreviewMouseWheelHandler(Parent, OnMouseWheel);
        }
Exemplo n.º 4
0
        public DropDown()
        {
            Mouse.AddPreviewMouseDownOutsideCapturedElementHandler(this, CapturedMouse_Click);
            Mouse.AddPreviewMouseMoveHandler(this, CapturedMouse_Move);

            Keyboard.AddKeyDownHandler(this, CapturedKeyboard_KeyDown);

            AddHandler(DropDown.MouseLeaveEvent,
                       new RoutedEventHandler(PopUp_MouseLeave));

            InitializeDelegateDictionary();
        }
Exemplo n.º 5
0
        public void AddDialog(Window dlg)
        {
            if (dlg == null || _applicationDialogs.Contains(dlg))
            {
                return;
            }

            _applicationDialogs.Add(dlg);
            Mouse.AddPreviewMouseMoveHandler(dlg, OnPreviewMouseMove);
            Keyboard.AddPreviewKeyDownHandler(dlg, OnPreviewKeyDown);

            dlg.Activated   += OnWindowActivated;
            dlg.Deactivated += OnWindowDeactivated;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Track"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="name">The element's identifying name within its namescope.</param>
        public Track(UltravioletContext uv, String name)
            : base(uv, name)
        {
            this.Thumb = new Button(uv, null)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Focusable           = false,
            };
            this.Thumb.Classes.Add("track-thumb");
            this.Thumb.ChangeLogicalAndVisualParents(this, this);
            KeyboardNavigation.SetIsTabStop(this.Thumb, false);

            this.IncreaseButton = new RepeatButton(uv, null)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Opacity             = 0,
                Focusable           = false,
            };
            this.IncreaseButton.Classes.Add("track-increase");
            this.IncreaseButton.Click += HandleIncreaseButtonClick;
            this.IncreaseButton.ChangeLogicalAndVisualParents(this, this);
            KeyboardNavigation.SetIsTabStop(this.IncreaseButton, false);

            this.DecreaseButton = new RepeatButton(uv, null)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Opacity             = 0,
                Focusable           = false,
            };
            this.DecreaseButton.Classes.Add("track-decrease");
            this.DecreaseButton.Click += HandleDecreaseButtonClick;
            this.DecreaseButton.ChangeLogicalAndVisualParents(this, this);
            KeyboardNavigation.SetIsTabStop(this.DecreaseButton, false);

            Mouse.AddPreviewMouseMoveHandler(this.Thumb, HandleThumbPreviewMouseMove);
            Mouse.AddPreviewMouseDownHandler(this.Thumb, HandleThumbPreviewMouseDown);
            Mouse.AddPreviewMouseUpHandler(this.Thumb, HandleThumbPreviewMouseUp);
        }