WPF-Base/WPF路由事件-5-处理按键事件/MainWindow.xaml

33 lines
1.4 KiB
XML

<Window x:Class="WPF路由事件_5_处理按键事件.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"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Margin="3" HorizontalAlignment="Left">Home:</Label>
<TextBox Grid.Row="0" Grid.Column="1" Margin="3" Padding="2" Height="Auto"
PreviewKeyDown="UIElement_OnPreviewKeyDown" PreviewTextInput="UIElement_OnPreviewTextInput"/>
</Grid>
<ListBox Grid.Row="1" Name="ListBox" />
<StackPanel Grid.Row="2">
<CheckBox Name="CheckBox">忽略长按key</CheckBox>
<Button HorizontalAlignment="Right" Click="ButtonBase_OnClick"> 清除列表</Button>
</StackPanel>
</Grid>
</Window>