public void TryAddToolbox(T key, System.Windows.Controls.UserControl data) { if (data != null && data.DataContext is DataModel == false) { throw new ArgumentException($"The plug-in ({data.GetType().Assembly.FullName}) is not compatible with this framework"); } __toolbox_collection.TryAdd(key, data); __tooldata_collection.TryAdd(key, data.DataContext as DataModel); }
public WpfHostingWinForm([NotNull] UserControl wpfControl) { _wpfControl = wpfControl; InitializeComponent(); string contextId = _wpfControl.GetType().Name; _formStateManager = new FormStateManager <FormState>(this, contextId); _formStateManager.RestoreState(); }
public TaskPaneControl(System.Windows.Controls.UserControl userControl, string name) { var controlHost = new TaskPaneWpfControlHost(); this.userControl = userControl; if (userControl.GetType().Name.Equals("Settings")) { var control = userControl as UI.Settings.Settings; control.ParentControl = this; } controlHost.WpfElementHost.HostContainer.Children.Add(userControl); control = controlHost; this.name = name; }