Exemplo n.º 1
0
        //ay 命令模式开发控件 2015年12月9日16:13:14
        //public ICommand Click { get; set; }
        //public ICommand MouseEnterCommand { get; set; }
        //public ICommand MouseLeaveCommand { get; set; }


        private void HyberMouseDownEvent(object sender, RoutedEventArgs e)
        {
            if (Mouse.LeftButton == MouseButtonState.Pressed)
            {
                AyCommandParameter ap = new AyCommandParameter {
                    Sender = sender, e = e
                };
                if (Click != null)
                {
                    if (Click.CanExecute(ap))
                    {
                        if (ForegroundPressed != null)
                        {
                            this.Foreground = ForegroundPressed;
                        }
                        Click.Execute(ap);
                    }
                }
                else
                {
                    if (ForegroundPressed != null)
                    {
                        this.Foreground = ForegroundPressed;
                    }
                }
                e.Handled = true;
            }
        }