fsprojects / FsXaml

F# Tools for working with XAML Projects
http://fsprojects.github.io/FsXaml/
MIT License
171 stars 48 forks source link

A case where XAML event is not found #69

Open BentTranberg opened 6 years ago

BentTranberg commented 6 years ago

Description

There was no handler to override when the XAML looked like this.

<MenuItem Header="{Binding Source={x:Static lang:Resources.Exit}}" Click="MnExitClick"/>

The error message from the compiler was: "No abstract or interface member was found that corresponds to this override."

type MainWindowXaml = XAML<"Xaml/MainWindow.xaml">

type MainWindow() =
    inherit MainWindowXaml()
    override x.MnExitClick (o, e) = x.Close()

Known workarounds

I moved the handler declaration to the front, like this, and then it compiled and ran successfully.

<MenuItem Click="MnExitClick" Header="{Binding Source={x:Static lang:Resources.Exit}}"/>

Related information

Windows 10. VS 2015 with Update 3. NET Framework 4.5.2. FsXaml 3.1.6.