dotnet / dotnet/wpf

Markup extensions in EventSetter do not work

Open
#5,353 4 comments 0 reactions 0 assignees View on GitHub
Feature Request
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .NET Core Version: .NET 5
* Windows version: 21H1 19043.1237
* Does the bug reproduce also in WPF for .NET Framework 4.8?: N/A - library only supports netcore3+

**Problem description:**

While attempting to make my [Method Binding Extension](https://github.com/Singulink/Singulink.WPF.Data.MethodBinding) work with `EventSetter`, it turned out that setting the `Handler` property to a markup extension does not appear to work. The markup extension is never instantiated (so `ProvideValue()` is not called). Instead, the following exception is thrown on `InitializeComponent()`:

```
System.Windows.Markup.XamlParseException: ''XAML Node Stream: Missing EndMember for 'WpfApp2.MainWindow.System.Windows.FrameworkElement.Resources' before EndObject.'
```

Sample code:
```xml


<EventSetter Event="Click" Handler="{s:MethodBinding OnButtonClick}" />


```

The issue is 100% NOT the XAML structure.

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.