private static void OnActiveEditModePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            PropertyContainer container = (PropertyContainer)obj;

            PropertyContainer.UpdateControlTemplate(container);
            if (container.ActiveEditModeChanged != null)
            {
                container.ActiveEditModeChanged((object)container, EventArgs.Empty);
            }
            if (!object.Equals(e.NewValue, (object)PropertyContainerEditMode.Dialog))
            {
                return;
            }
            IInputElement inputElement = container.DialogCommandSource ?? (IInputElement)container;

            if (PropertyContainer.OpenDialogWindow.CanExecute((object)container.PropertyEntry, inputElement))
            {
                PropertyContainer.OpenDialogWindow.Execute((object)container.PropertyEntry, inputElement);
            }
            else
            {
                DialogPropertyValueEditor propertyValueEditor = container.FindDialogPropertyValueEditor();
                if (propertyValueEditor != null)
                {
                    propertyValueEditor.ShowDialog(container.PropertyEntry.PropertyValue, inputElement);
                }
            }
            container.ActiveEditMode = (PropertyContainerEditMode)e.OldValue;
        }
        private DialogPropertyValueEditor FindDialogPropertyValueEditor()
        {
            PropertyEntry             propertyEntry       = this.PropertyEntry;
            DialogPropertyValueEditor propertyValueEditor = (DialogPropertyValueEditor)null;

            if (propertyEntry != null)
            {
                propertyValueEditor = propertyEntry.PropertyValueEditor as DialogPropertyValueEditor;
            }
            if (propertyValueEditor != null)
            {
                return(propertyValueEditor);
            }
            if (propertyEntry != null && propertyEntry.HasStandardValuesInternal)
            {
                propertyValueEditor = this.DefaultStandardValuesPropertyValueEditor as DialogPropertyValueEditor;
            }
            return(propertyValueEditor ?? this.DefaultPropertyValueEditor as DialogPropertyValueEditor);
        }