共用方式為


EventSetter.Handler 屬性

定義

取得或設定 setter 中路由事件之處理常式的參考。

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

屬性值

由這個 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>

適用於

另請參閱