Exemplo n.º 1
0
 void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == FilterModel.FilterExceptionPropertyName)
     {
         if (!this.txtFilterText.BindingGroup.ValidateWithoutUpdate())
         {
             this.txtFilterText.Focus();
         }
     }
     else if (e.PropertyName == FilterModel.ModePropertyName)
     {
         this.txtFilterText.Text = HistoryItems.Latest(this.Model.Mode).Term;
         this.txtFilterText.SelectAll();
     }
 }
Exemplo n.º 2
0
        void SetSelectionFromHistory(ListBox lb, Popup parent)
        {
            parent.IsOpen = false;
            // Get the selected item value
            string insertItem = lb.SelectedItem.ToString();

            var item = HistoryItems.SetLatest(insertItem);

            // Save the Caret position
            int i = txtFilterText.CaretIndex;

            // Move the caret to the end of the added text
            this.txtFilterText.Text  = item.Term;
            txtFilterText.CaretIndex = i + item.Term.Length;

            // Move focus back to the text box.
            // This will auto-hide the PopUp due to StaysOpen="false"
            this.Focus();
        }
Exemplo n.º 3
0
 private void ExecuteHandler(string obj)
 {
     HistoryItems.Add(this.Model.FilterText, this.Model.Mode);
 }