/// <summary> /// This method is needed to find the correct item in <paramref name="view"/> that corresponds /// to the original input source <paramref name="item"/>. It is called by /// <see cref="InstallInView"/> to correctly determine the new event inputs for the copied /// condition. /// </summary> /// <remarks>This implementation just queries <see cref="IModelView.GetViewItem"/> for /// <paramref name="item"/>, and returns the result from this call, or <see langword="null"/> /// if <paramref name="item"/> does not implement <see cref="IOptionItem"/>.</remarks> /// <param name="view">The view where the condition is currently installed</param> /// <param name="item"></param> /// <returns>A <see cref="INotifyPropertyChanged"/> instance that corresponds /// to <paramref name="item"/> in <paramref name="view"/>.</returns> protected virtual INotifyPropertyChanged GetItemCopy(IModelView view, INotifyPropertyChanged item) { IOptionItem viewItem = item as IOptionItem; if (viewItem != null) { return(view.GetViewItem(viewItem)); } return(null); }
public IAction InstallInView(IModelView view) { IAction retval = null; IOptionItem viewItem = view.GetViewItem(target); if (viewItem != null) { retval = new SetEnabledAction(viewItem, invert); } return(retval); }
/// <summary> /// Called when the <see cref="View">view</see> changed. /// </summary> /// <param name="oldView">The old view.</param> /// <param name="newView">The new view.</param> protected virtual void OnViewChanged(IModelView oldView, IModelView newView) { if (view != null) { SetValue(RootItemProperty, null); } this.view = newView; if (this.view != null) { view.IsAutoAdopt = IsAutoAdopt; view.IsAutoCommit = IsAutoCommit; IOptionGroup item = view.GetViewItem(view.Handler) as IOptionGroup; SetValue(RootItemProperty, item); } else { SetValue(RootItemProperty, null); } }