private IOptionWrapper WrapSimpleOption(UserControlWrapper menuItem, ContentControl control) { if (control == null) { throw new ArgumentNullException(nameof(control)); } if (control is CheckBox checkBox) { return(new CheckBoxWrapper(menuItem, checkBox)); } throw new ArgumentException("Argument must be a wrappable option type.", nameof(control)); }
private IOptionWrapper WrapOption(UserControlWrapper menuItem, DependencyObject depObj) { if (depObj is DockPanel dockPanel) { foreach (var child in dockPanel.Children) { if (child is CheckBox) { return(WrapSimpleOption(menuItem, child as CheckBox)); } } } return(WrapSimpleOption(menuItem, depObj as ContentControl)); }
public CheckBoxWrapper(UserControlWrapper menuItem, CheckBox checkBox) : base(menuItem, checkBox) { }
protected OptionWrapper(UserControlWrapper menuItem, T control) { MenuItem = menuItem; Control = control; }