穿上试试……跟我来
在Xaml文件中:
<Window.Resources>
<RoutedUICommand x:Key="cmd1"></RoutedUICommand>
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="{StaticResource cmd1}" Executed="btn_font_Click"> </CommandBinding>
</Window.CommandBindings>
<Window.InputBindings>
<KeyBinding Key="F1" Command="{StaticResource cmd1}"></KeyBinding>
</Window.InputBindings>
<Button Command="{StaticResource cmd1}" Name="btn_font" Grid.Column="2" Grid.Row="1" Width="60" Height="25" Content="Enter" Click="btn_font_Click" Margin="10,2"/>
private void btn_font_Click(object sender, RoutedEventArgs e)
{
Font_Chooser fc = new Font_Chooser();
fc.ShowDialog();
}