dotnet / dotnet/wpf

EventSetter. Check of HandlerType

Open
#806 8 comments 0 reactions 0 assignees View on GitHub
Enhancement Requested
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

Hi!
(master)
**Problem description:**

```csharp
//EventSetter.cs
if (_handler.GetType() != _event.HandlerType)
{
throw new ArgumentException(SR.Get(SRID.HandlerTypeIllegal));
}

```
Why is there a strict check?
What if I want to set an action handler type ~~EventArgs~~ ```Action```? (updated text)
This possibility is, if you do not use styles.
```xml

```
```csharp

this.AddHandler(MouseMoveEvent,

new RoutedEventHandler((object sender, RoutedEventArgs args) => ...
```

[old question](https://social.msdn.microsoft.com/Forums/en-US/7b4ce02d-bdf1-4b7c-97d4-b7526b1792b2/wpfeventsetterstrong-handler-type?forum=wpf)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.