Show / Hide Table of Contents

Class PropertyHelper

Extension-Method for PropertyChanged. If you don't like to inherit from ModelBase, use this.

Inheritance
System.Object
PropertyHelper
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Extensions
Assembly: Sartorius.SAF.dll
Syntax
public static class PropertyHelper
Examples
    public  class SomeViewModel : INotifyPropertyChanged

   string someProperty;
   public string SomeProperty
   {
       get { return someProperty; }
       set
       {
           someProperty = value;
           this.RaisePropertyChanged(() => SomeProperty, PropertyChanged);
       }
   }
   public event PropertyChangedEventHandler PropertyChanged;
}

Methods

View Source

ExtractPropertyName<T>(Expression<Func<T>>)

Extracts the name of the property.

Declaration
public static string ExtractPropertyName<T>(Expression<Func<T>> propertyExpression)
Parameters
Type Name Description
System.Linq.Expressions.Expression<System.Func<T>> propertyExpression

The property expression.

Returns
Type Description
System.String
Type Parameters
Name Description
T
View Source

RaisePropertyChanged<T>(INotifyPropertyChanged, Expression<Func<T>>, PropertyChangedEventHandler)

Raises the property changed. use:

this.RaisePropertyChanged(() => SomeProperty, PropertyChanged);
Declaration
public static void RaisePropertyChanged<T>(this INotifyPropertyChanged src, Expression<Func<T>> propertyExpression, PropertyChangedEventHandler handler)
Parameters
Type Name Description
System.ComponentModel.INotifyPropertyChanged src

The SRC.

System.Linq.Expressions.Expression<System.Func<T>> propertyExpression

The property expression.

System.ComponentModel.PropertyChangedEventHandler handler

The handler.

Type Parameters
Name Description
T
  • View Source
Back to top Generated by DocFX