Skip to content

Event handler members not generated when attribute using markup extension appears in XAML before the event attribute #75

@TeaDrivenDev

Description

@TeaDrivenDev

Description

FsXaml generates overridable event handler methods when event handlers are set from XAML. That does not work when in the same XAML element an attribute using a markup extension appears before the attribute setting the event handler.

Repro steps

  1. In the XAML element for a control that has an event handler set from XAML, put an attribute using a markup extension before the event handler attribute.
Background="{StaticResource XBrush}"
Closing="Window_Closing"

(A reproduction can be found at https://github.com/TeaDrivenDev/FsXaml_MarkupExtension_Event in MainWindow.xaml.)

Expected behavior

FsXaml generates a virtual method for the event handler that can be overriden in a derived class.

Actual behavior

FsXaml does not generate the virtual method, and attempting to override it results in a compiler error. The specific markup extension does not appear to be important; the behavior is the same for x:Static, StaticResource and DynamicResource.

Known workarounds

Reorder the attributes, so that the event handler is set before any attributes using markup extensions.

Related information

FsXaml 3.1.6
FSharp.Core 4.3.4
Visual Studio 2017 15.5.7
.NET 4.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions