Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
Created February 5, 2011 01:05
Show Gist options
  • Select an option

  • Save anaisbetts/812092 to your computer and use it in GitHub Desktop.

Select an option

Save anaisbetts/812092 to your computer and use it in GitHub Desktop.
public static void RegisterDepPropCallback(This DependencyObject owner, DependencyProperty property, EventHandler handler)
{
var dpd = DependencyPropertyDescriptor.FromProperty(property, owner.GetType());
dpd.AddValueChanged(owner, handler);
}
mainWindow.RegisterDepPropCallback(MainWindowClass.ViewModelProperty, (o,e) => {
Console.WriteLine("ViewModel changed!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment