コード例 #1
0
        protected void AddMouseHandler()
        {
            Button.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Button_MouseLeftButtonDown), true);
            Button.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(Button_MouseLeftButtonUp), true);
            Button.AddHandler(MouseMoveEvent, new MouseEventHandler(Button_MouseMove), true);

            /*
             * PreviewMouseDownEvent required, because the
             * System.Windows.Controls.TextBox MouseLeftButtonUpEvent is buggy
             * -> e.ClickCount always stays at "1"
             */
            TextEdit.AddHandler(PreviewMouseDownEvent, new MouseButtonEventHandler(TextEdit_PreviewMouseDown), true);
        }