// Helper method to save the value of a template. This sets up all the right Undo state. static void PersistTemplate(TabPanel panel, IDesignerHost host, ITemplate template, string propertyName) { using (var transaction = host.CreateTransaction("SetEditableDesignerRegionContent")) { var propertyInfo = panel.GetType().GetProperty(propertyName); if (propertyInfo == null) { return; } propertyInfo.SetValue(panel, template, null); transaction.Commit(); } }
// Helper method to save the value of a template. This sets up all the right Undo state. static void PersistTemplate(TabPanel panel, IDesignerHost host, ITemplate template, string propertyName) { using(var transaction = host.CreateTransaction("SetEditableDesignerRegionContent")) { var propertyInfo = panel.GetType().GetProperty(propertyName); if(propertyInfo == null) return; propertyInfo.SetValue(panel, template, null); transaction.Commit(); } }
/// <summary> /// Notifies the handler, that a drag operation has started above the control /// </summary> /// <param name="effect"></param> public void NotifyDragStarted(DragDropEffect effect) { TabPanel TabPanel = this.element.GetVisualDescendantsDepthFirst <TabPanel>().FirstOrDefault(); if (TabPanel != null) { IDragDropUiTargetHandler Handler = DragDrop.GetDragDropUITargetHandler(TabPanel.GetType()); if (Handler != null) { this.panelTargetHandler = Handler.Create(TabPanel, this.adapter, false); } } if (this.panelTargetHandler == null) { this.panelTargetHandler = new DummyUiHandler(); } this.panelTargetHandler.NotifyDragStarted(effect); }