コード例 #1
0
        public void SortByValue()
        {
            List <KeyValuePairModel> sortByValueList = MyDisplayListBox.OrderBy(x => x.Value).ToList();

            MyDisplayListBox = new BindingList <KeyValuePairModel>(sortByValueList);
            NotifyOfPropertyChange(() => MyDisplayListBox);
        }
コード例 #2
0
        public void Filter(string inputTextBox)
        {
            List <KeyValuePairModel> filteredList = MyDisplayListBox.Where(x => x.KeyValuePair == inputTextBox).ToList();

            fullList         = MyDisplayListBox;
            MyDisplayListBox = new BindingList <KeyValuePairModel>(filteredList);
            NotifyOfPropertyChange(() => MyDisplayListBox);
            NotifyOfPropertyChange(() => CanFilter);
        }
コード例 #3
0
 //Just to simulate database in a constructor.
 public EspLabTestViewModel()
 {
     MyDisplayListBox.Add(new KeyValuePairModel {
         Key = "Hello", Value = "World"
     });
     MyDisplayListBox.Add(new KeyValuePairModel {
         Key = "FirstName", Value = "Sujit"
     });
     MyDisplayListBox.Add(new KeyValuePairModel {
         Key = "Language", Value = "CSharp"
     });
     MyDisplayListBox.Add(new KeyValuePairModel {
         Key = "MVVM", Value = "Caliburn"
     });
 }
コード例 #4
0
        public void AddToList(string inputTextBox)
        {
            ValidateInput(inputTextBox);
            if (Key != null || Value != null)
            {
                KeyValuePairModel newKeyValuePair = new KeyValuePairModel
                {
                    Key   = Key,
                    Value = Value
                };
                MyDisplayListBox.Add(newKeyValuePair);

                NotifyOfPropertyChange(() => MyDisplayListBox);
            }
        }
コード例 #5
0
 //Delete Selected keyvalue pair from the listbox
 public void DeleteSelectedText()
 {
     MyDisplayListBox.Remove(SelectedKeyValuePair);
     NotifyOfPropertyChange(() => MyDisplayListBox);
 }