Created
June 7, 2013 09:25
-
-
Save toburger/5728124 to your computer and use it in GitHub Desktop.
Extension method to allow the use of Quotation Expressions for NotifyPropertyChanged
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<AutoOpen>] | |
module PropertyChangedBaseEx | |
open Caliburn.Micro | |
open System | |
open System.Linq.Expressions | |
open Microsoft.FSharp.Linq.QuotationEvaluation | |
open Microsoft.FSharp.Quotations | |
type PropertyChangedBase with | |
member self.NotifyOfPropertyChange (expr: Expr<'a>) = | |
let body = expr.ToLinqExpression() | |
let func = Expression.Lambda<Func<'a>>(body) | |
self.NotifyOfPropertyChange func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage example: