public void OnOpenDialogWindow(object sender, ExecutedRoutedEventArgs e) { // Hook on to the system user-preference changed event. SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(OnUserPreferenceChanged); // Is there a DataTemplate and PropertyValue to display? PropertyEntry parentProperty = GetParentProperty(e.OriginalSource); DataTemplate dialogEditorTemplate = GetDialogEditorTemplate(parentProperty); if (dialogEditorTemplate == null) { return; } // Create and populate a new Form _dialogWindow = new Form(); _dialogWindow.ShowInTaskbar = false; _dialogWindow.ShowIcon = false; _dialogWindow.MaximizeBox = false; _dialogWindow.MinimizeBox = false; _dialogWindow.HelpButton = false; _dialogWindow.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Auto; _dialogWindow.Width = 600; _dialogWindow.Height = 400; // We need to change the title based on the type of the property being edited. // e.g: For CollectionEditors we should say "CollectionEditor : <DisplayName>" // For everything else we should say "Property Editor : <DisplayName>" string title = System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_DialogValueEditorTitle; _dialogWindow.MinimumSize = new System.Drawing.Size(575, 400); // Magic min-size numbers from Dan _dialogWindow.Text = string.Format( CultureInfo.CurrentCulture, title, parentProperty.DisplayName); PropertyValueDialogControl dialogControl = new PropertyValueDialogControl(parentProperty, dialogEditorTemplate); dialogControl.CloseParentDialog += new EventHandler(OnCloseParentDialog); using (ElementHost elementHost = new ElementHost()) { elementHost.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; elementHost.Size = _dialogWindow.ClientSize; elementHost.Child = dialogControl; _dialogWindow.Controls.Add(elementHost); _dialogWindow.ShowDialog(); dialogControl.OnParentDialogClosing(); } }