zoukankan      html  css  js  c++  java
  • WPF 组合快捷键(Ctrl+C)

    页面程序:

    <Window x:Class="WpfDataGrid.Window1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Window1" Height="300" Width="300">
        <Window.Resources>
            <RoutedUICommand x:Key="btnClick" Text="Button Click"/> 
        </Window.Resources>
        <Window.InputBindings>
            <KeyBinding Gesture="Ctrl+C" Key="C" Command="{StaticResource btnClick}"/>
        </Window.InputBindings>
        <Window.CommandBindings>
            <CommandBinding Command="{StaticResource btnClick}"
                            CanExecute="CommandBinding_CanExecute"
                            Executed="CommandBinding_Executed"/>
        </Window.CommandBindings>
        <Grid>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="105,76,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        </Grid>
    </Window>

    后台代码:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;

    namespace WpfDataGrid
    {
        /// <summary>
        /// Interaction logic for Window1.xaml
        /// </summary>
        public partial class Window1 : Window
        {
            public Window1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, RoutedEventArgs e)
            {
                MainWindow main = new MainWindow();
                main.ShowDialog();
            }

            private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
            {
                e.CanExecute = true;
            }

            private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
            {
                button1_Click(this, null);
            }
        }
    }

  • 相关阅读:
    特殊json处理
    css3
    居中定位
    微信支付
    vue 封装cookie,请求,登录拦截,接口拦截
    vue中axios的封装(简易版拦截,get,post
    JS的Event Loop
    JS模块化
    JS的排序算法
    时间复杂度 空间复杂度
  • 原文地址:https://www.cnblogs.com/RR-ghost/p/5437805.html
Copyright © 2011-2022 走看看