private static void CommandPropertyChangedCallBack(
DependencyObject inDependencyObject, DependencyPropertyChangedEventArgs inEventArgs)
{
var uiElement = inDependencyObject as UIElement; // Remove the handler if it exist to avoid memory leaks
if (uiElement != null)
{
uiElement.Drop -= UIElement_Drop;
}
var command = inEventArgs.NewValue as ICommand;
if (command == null)
{
return;
}
// the property is attached so we attach the Drop event handler
if (uiElement != null)
{
uiElement.Drop += UIElement_Drop;
}
}