摘要:
1 <Window x:Class="RoutedEvents.TunneledKeyPress" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 Title="TunneledKeyPress" Height="411" Width="403" 5 PreviewK 阅读全文
摘要:
假设StackPanel包装了一些按钮,并且希望一个事件中处理程序中所有这些按钮的单击事件。粗略的方法是将每个按钮的Click事件关联到同一个事件处理程序。但是Click支持事件冒泡,从而提供了一个更好的选择。可以通过更高层次元素的Click事件(如StackPanel面板)来处理所有按钮的单击事件。 1 <Window x:Class="Page111.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="ht 阅读全文