完善主体资料,免费赠送VIP会员!
* 主体类型
* 企业名称
* 信用代码
* 所在行业
* 企业规模
* 所在职位
* 姓名
* 所在行业
* 学历
* 工作性质
请先选择行业
您还可以选择以下福利:
行业福利,领完即止!

下载app免费领取会员

NULL

5cdd2dc095060.jpg

二次开发教程:WPF 设置快捷键

发布于:2019-07-25 15:25:33

网友投稿

更多

在WPF里可以通过InputBindings来设置快捷键


<Window x:Class="ShortCutDemo.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        xmlns:ignore="http://www.galasoft.ch/ignore"

        mc:Ignorable="d ignore"

        Height="300"

        Width="300"

        Title="MVVM Light Application"

        DataContext="{Binding Main, Source={StaticResource Locator}}">

    

    <Window.Resources>

        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>

                <ResourceDictionary Source="Skins/MainSkin.xaml" />

            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>

    </Window.Resources>

    <Window.InputBindings>

        <KeyBinding Command="{Binding TestCommand}" Key="Space"  Modifiers="Alt"/>

    </Window.InputBindings>


    <Grid x:Name="LayoutRoot">

        <Button x:Name="button" Command="{Binding TestCommand}" Content="Button" HorizontalAlignment="Left" Margin="117,128,0,0" VerticalAlignment="Top" Width="75"/>

    </Grid>

</Window>

本文版权归腿腿教学网及原创作者所有,未经授权,谢绝转载。

未标题-1.jpg

上一篇:二次开发教程:C# udp小程序

下一篇:二次开发教程:C# 读取config文件

60acb4e0ef112.png