I have a CLR instance property, a static PropertyPath which points to the instance property and a xaml binding which uses the static PropertyPath directly like so:
NB: GetPropertyPath is simply a method which returns the propertypath based on the given linq expression from the member name.
public static PropertyPath MyPropertyPath = GetPropertyPath(p=> p.MyProperty);
private object _myProperty;
public object MyProperty
{
get{ return _myProperty;}
set
{
_myProperty = value;
OnPropertyChanged(MyPropertyPath.Path);
}
}
Then with MyViewModel as the datacontext in standard mvvm fashion the xaml binding is given as:
{Binding Path={x:Static myNamespace:MyViewModel.MyPropertyPath}}
This approach has major benefit as the code does not use any references which are not checked as part of the build. If something is changed in the viewmodel code the xaml bindings error at build if they are no longer correct.
My question is this, is anyone aware of any negative performance impacts this approach could possibly have?