EventSetter.Handler 属性

定义

获取或设置对资源库中路由事件的处理程序的引用。

public:
 property Delegate ^ Handler { Delegate ^ get(); void set(Delegate ^ value); };
public Delegate Handler { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.EventSetterHandlerConverter))]
public Delegate Handler { get; set; }
member this.Handler : Delegate with get, set
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.EventSetterHandlerConverter))>]
member this.Handler : Delegate with get, set
Public Property Handler As Delegate

属性值

Delegate

对此 EventSetter 所附加处理程序的引用。

属性

示例

以下示例将 Handler 属性设置为标记样式的一 EventSetter 部分。

<StackPanel
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SDKSample.EventOvw2"
  Name="dpanel2"
  Initialized="PrimeHandledToo"
>
  <StackPanel.Resources>
    <Style TargetType="{x:Type Button}">
      <EventSetter Event="Click" Handler="b1SetColor"/>
    </Style>
  </StackPanel.Resources>
  <Button>Click me</Button>
  <Button Name="ThisButton" Click="HandleThis">
    Raise event, handle it, use handled=true handler to get it anyway.
  </Button>
</StackPanel>

适用于

另请参阅