private void CanExecuteChanged()
{
if( Command != null )
{
RoutedCommand command = Command as RoutedCommand;
// If a RoutedCommand.
if( command != null )
IsEnabled = command.CanExecute( CommandParameter, CommandTarget ) ? true : false;
// If a not RoutedCommand.
else
IsEnabled = Command.CanExecute( CommandParameter ) ? true : false;
}
}