protected virtual void OnHighlightedItemChanged(DependencyPropertyChangedEventArgs e)
{
if (HighlightChanged != null)
{
HighlightChanged(this, EventArgs.Empty);
}
if (ShouldExecuteCommand && e.OldValue != null)
{
CommandHelpers.InvokeCommandSource(CommandParameter, PreviewCommandParameter, this, CommandOperation.CancelPreview);
}
if (ShouldExecuteCommand && e.NewValue != null)
{
// Fire the Preview operation on a Dispatcher callback to allow the
// PreviewCommandParameter's Binding to be updated to match the HighlightedItem
Dispatcher.BeginInvoke(DispatcherPriority.Send, (DispatcherOperationCallback)delegate(object unused)
{
CommandHelpers.InvokeCommandSource(CommandParameter, PreviewCommandParameter, this, CommandOperation.Preview);
return null;
}, null);
}
}