Exemplo n.º 1
0
        private static void OnSetToolTipChanged(
            DependencyObject d,
            DependencyPropertyChangedEventArgs e)
        {
            CustomComboBox customComboBox = d as CustomComboBox;

            if (!customComboBox.ToolTipWhenTrimmed)
            {
                return;
            }
            customComboBox.OnSetToolTipChanged(e);
        }
        public static bool IsTextTrimmed(this CustomComboBox comboBox, string text)
        {
            if (comboBox == null)
            {
                return(false);
            }
            Typeface typeface = new Typeface(comboBox.FontFamily, comboBox.FontStyle, comboBox.FontWeight, comboBox.FontStretch);

            return(new FormattedText(text, Thread.CurrentThread.CurrentCulture, comboBox.FlowDirection, typeface, comboBox.FontSize, comboBox.Foreground)
            {
                MaxTextWidth = comboBox.ActualWidth,
                Trimming = TextTrimming.None
            }.Height > comboBox.ActualHeight);
        }
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mOrientation = (CustomComboBox)target;
                break;

            case 2:
                this.mRadioButtons = (Grid)target;
                break;

            case 3:
                this.mResolution960x540 = (CustomRadioButton)target;
                break;

            case 4:
                this.mResolution1280x720 = (CustomRadioButton)target;
                break;

            case 5:
                this.mResolution1600x900 = (CustomRadioButton)target;
                break;

            case 6:
                this.mResolution1920x1080 = (CustomRadioButton)target;
                break;

            case 7:
                this.mResolution2560x1440 = (CustomRadioButton)target;
                break;

            case 8:
                this.CustomResolutionTextBoxes = (Grid)target;
                break;

            case 9:
                this.CustomResolutionWidth = (CustomTextBox)target;
                break;

            case 10:
                this.CustomResolutionHeight = (CustomTextBox)target;
                break;

            case 11:
                this.mDpi160 = (CustomRadioButton)target;
                break;

            case 12:
                this.mDpi240 = (CustomRadioButton)target;
                break;

            case 13:
                this.mDpi320 = (CustomRadioButton)target;
                break;

            case 14:
                this.mInfoIcon = (CustomPictureBox)target;
                break;

            case 15:
                this.mSaveButton = (CustomButton)target;
                break;

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