Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the popup.
        /// </summary>
        private void Initialize()
        {
            this.m_Popup = new AutoCompletePopup
            {
                Width           = this.m_AttachedTextBox.Width,
                DataContext     = this,
                Placement       = PlacementMode.Bottom,
                PlacementTarget = this.m_AttachedTextBox
            };
            this.m_Provider = AutoComplete.GetDataProvider(this.m_AttachedTextBox);
            if (this.m_Provider == null)
            {
                throw new InvalidOperationException("Data provider for auto complete must not be null!");
            }

            this.m_AttachedTextBox.TextChanged    += TextBoxTextChanged;
            this.m_AttachedTextBox.PreviewKeyDown += TextBoxKeyDown;
            this.m_AttachedTextBox.LostFocus      += TextBoxLostFocus;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the IAutoCompleteDataProvider for the given UI element.
 /// </summary>
 /// <param name="target">UI element to set IAutoCompleteDataProvider.</param>
 /// <param name="value">IAutoCompleteDataProvider to use.</param>
 public static void SetDataProvider(UIElement target, IAutoCompleteDataProvider value)
 {
     target.SetValue(DataProviderProperty, value);
 }