Пример #1
0
        private static void WrappedValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (object.Equals(e.OldValue, e.NewValue))
            {
                return;
            }
            TextChoiceEditorWrapper choiceEditorWrapper = d as TextChoiceEditorWrapper;

            if (choiceEditorWrapper == null || choiceEditorWrapper.isUpdatingValue)
            {
                return;
            }
            choiceEditorWrapper.isUpdatingValue = true;
            try
            {
                object newValue = e.NewValue;
                if (newValue != null && newValue != MixedProperty.Mixed && newValue is double)
                {
                    choiceEditorWrapper.TextChoiceEditor.Value = (object)UnitTypedSize.CreateFromPixels((double)newValue, choiceEditorWrapper.UnitType);
                }
                else
                {
                    choiceEditorWrapper.TextChoiceEditor.Value = null;
                }
            }
            finally
            {
                choiceEditorWrapper.isUpdatingValue = false;
            }
        }
Пример #2
0
        private static void UnitTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (object.Equals(e.OldValue, e.NewValue))
            {
                return;
            }
            TextChoiceEditorWrapper choiceEditorWrapper = d as TextChoiceEditorWrapper;

            if (choiceEditorWrapper == null || !(e.NewValue is UnitType))
            {
                return;
            }
            UnitType unitType = (UnitType)e.NewValue;

            choiceEditorWrapper.textTypeConverter = new Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.TextSizeConverter(unitType);
            choiceEditorWrapper.OnPropertyChanged("TextSizeConverter");
            if (choiceEditorWrapper.isUpdatingValue)
            {
                return;
            }
            choiceEditorWrapper.isUpdatingValue = true;
            try
            {
                UnitTypedSize unitTypedSize = choiceEditorWrapper.TextChoiceEditor.Value as UnitTypedSize;
                if (unitTypedSize == null)
                {
                    return;
                }
                choiceEditorWrapper.TextChoiceEditor.Value = (object)unitTypedSize.ConvertTo(unitType);
            }
            finally
            {
                choiceEditorWrapper.isUpdatingValue = false;
            }
        }
Пример #3
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.TextChoiceEditorWrapper_1 = (TextChoiceEditorWrapper)target;
                break;

            case 2:
                this.TextChoiceEditor = (ChoiceEditor)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }