Creating WPF Commands in F#

Another quick post to demonstrate how to create WPF Command classes in F#. Notably, these include a CLR event in the inherited interface that needs to be implemented in F#.



open Microsoft.FSharp.Control
open System.Windows.Input

type MyCustomCommand() =

  // This is the member field for the event
  let CanExecuteChangedEvent = new Event<_,_>()

  interface ICommand with
    member self.Execute (argument:obj) = ()
    member self.CanExecute (argument:obj) = true
    member self.CanExecuteChanged = 

The F# source code for Event is good educational reading for the curious!

Reference material:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s