Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

EventSetter.Handler Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the reference to a handler for a routed event in the setter.

Namespace:   System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

[TypeConverterAttribute(typeof(EventSetterHandlerConverter))]
public Delegate Handler { get; set; }

Property Value

Type: System.Delegate

Reference to the handler that is attached by this EventSetter.

The following example sets the Handler property as part of a EventSetter in a markup style.

<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>

.NET Framework
Available since 3.0
Return to top
Show:
© 2017 Microsoft