コード例 #1
0
        /// <summary>
        ///     Called when <see cref="DelayedTextBox.DelayTime" /> property changes.
        /// </summary>
        /// <param name="dependencyObject">The dependency object.</param>
        /// <param name="e">
        ///     The <see cref="System.Windows.DependencyPropertyChangedEventArgs" /> instance containing the event
        ///     data.
        /// </param>
        private static void OnDelayTimeChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            DelayedTextBox delayedTextBox = dependencyObject as DelayedTextBox;

            if (delayedTextBox != null)
            {
                delayedTextBox.DelayTime = (int)e.NewValue;
            }
        }
コード例 #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="AutoCompleteTextBox" /> class.
        /// </summary>
        public AutoCompleteTextBox()
        {
            _Controls = new VisualCollection(this);

            _ComboBox = new ComboBox();
            _ComboBox.IsSynchronizedWithCurrentItem = true;
            _ComboBox.IsTabStop         = false;
            _ComboBox.MaxDropDownHeight = 150;
            _ComboBox.SelectionChanged += ComboBox_SelectionChanged;

            _TextBox = new DelayedTextBox();
            _TextBox.VerticalContentAlignment = VerticalAlignment.Center;
            _TextBox.DelayedTextChanging     += TextBox_DelayedTextChanging;
            _TextBox.TextChanged        += TextBox_OnTextChanged;
            _TextBox.KeyDown            += TextBox_OnKeyDown;
            _TextBox.DelayedTextChanged += TextBox_DelayedTextChanged;
            _TextBox.PreviewKeyDown     += TextBox_OnPreviewKeyDown;

            _Controls.Add(_ComboBox);
            _Controls.Add(_TextBox);
        }