public void SortByValue()
        {
            List <KeyValuePairModel> sortByValueList = MyDisplayListBox.OrderBy(x => x.Value).ToList();

            MyDisplayListBox = new BindingList <KeyValuePairModel>(sortByValueList);
            NotifyOfPropertyChange(() => MyDisplayListBox);
        }
        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);
        }
 //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"
     });
 }
        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);
            }
        }
 //Delete Selected keyvalue pair from the listbox
 public void DeleteSelectedText()
 {
     MyDisplayListBox.Remove(SelectedKeyValuePair);
     NotifyOfPropertyChange(() => MyDisplayListBox);
 }