Inheritance: System.Windows.Documents.Adorner
        private void Init()
        {
            m_TextBlockAdorner = new TextBlockAdorner(m_ComboBox, GetLabel(m_ComboBox), GetLabelStyle(m_ComboBox));
            UpdateAdorner();

            DependencyPropertyDescriptor focusProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsFocusedProperty, typeof(ComboBox));

            if (focusProp != null)
            {
                focusProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor focusKeyboardProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsKeyboardFocusedProperty, typeof(ComboBox));

            if (focusKeyboardProp != null)
            {
                focusKeyboardProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor focusKeyboardWithinProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsKeyboardFocusWithinProperty, typeof(ComboBox));

            if (focusKeyboardWithinProp != null)
            {
                focusKeyboardWithinProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor textProp = DependencyPropertyDescriptor.FromProperty(ComboBox.TextProperty, typeof(ComboBox));

            if (textProp != null)
            {
                textProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor selectedIndexProp = DependencyPropertyDescriptor.FromProperty(Selector.SelectedIndexProperty, typeof(ComboBox));

            if (selectedIndexProp != null)
            {
                selectedIndexProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor selectedItemProp = DependencyPropertyDescriptor.FromProperty(Selector.SelectedItemProperty, typeof(ComboBox));

            if (selectedItemProp != null)
            {
                selectedItemProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }
        }
Ejemplo n.º 2
0
        private void Init()
        {
            m_TextBlockAdorner = new TextBlockAdorner(m_TextBox, GetLabel(m_TextBox), GetLabelStyle(m_TextBox));
            UpdateAdorner();

            DependencyPropertyDescriptor focusProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsFocusedProperty, typeof(FrameworkElement));

            if (focusProp != null)
            {
                focusProp.AddValueChanged(m_TextBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor containsTextProp = DependencyPropertyDescriptor.FromProperty(HasTextProperty, typeof(TextBox));

            if (containsTextProp != null)
            {
                containsTextProp.AddValueChanged(m_TextBox, (sender, args) => UpdateAdorner());
            }
        }
        private void Init()
        {
            m_TextBlockAdorner = new TextBlockAdorner(m_ComboBox, GetLabel(m_ComboBox), GetLabelStyle(m_ComboBox));
            UpdateAdorner();

            DependencyPropertyDescriptor focusProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsFocusedProperty, typeof(ComboBox));
            if (focusProp != null)
            {
                focusProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor focusKeyboardProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsKeyboardFocusedProperty, typeof(ComboBox));
            if (focusKeyboardProp != null)
            {
                focusKeyboardProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor focusKeyboardWithinProp = DependencyPropertyDescriptor.FromProperty(UIElement.IsKeyboardFocusWithinProperty, typeof(ComboBox));
            if (focusKeyboardWithinProp != null)
            {
                focusKeyboardWithinProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor textProp = DependencyPropertyDescriptor.FromProperty(ComboBox.TextProperty, typeof(ComboBox));
            if (textProp != null)
            {
                textProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor selectedIndexProp = DependencyPropertyDescriptor.FromProperty(Selector.SelectedIndexProperty, typeof(ComboBox));
            if (selectedIndexProp != null)
            {
                selectedIndexProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }

            DependencyPropertyDescriptor selectedItemProp = DependencyPropertyDescriptor.FromProperty(Selector.SelectedItemProperty, typeof(ComboBox));
            if (selectedItemProp != null)
            {
                selectedItemProp.AddValueChanged(m_ComboBox, (sender, args) => UpdateAdorner());
            }
        }