예제 #1
0
        public void Search()
        {
            if (_lookup == null)
            {
                return;
            }
            if (!_lookup.Any())
            {
                return;
            }

            var searchItem = txtSearch.Text;

            if (searchItem.Trim().Length == 0)
            {
                RefreshDisplay();
            }
            else
            {
                var filteredItem = from item in _lookup
                                   where item.Description.ToLower().Contains(searchItem.ToLower())
                                   select item;

                var viewModel = new MembershipTypeViewModel {
                    Collection = new MembershipTypeCollection()
                };
                foreach (var item in filteredItem)
                {
                    viewModel.Collection.Add(item);
                }
                _viewModel  = viewModel;
                DataContext = _viewModel;
            }
        }
예제 #2
0
 public void RefreshDisplay()
 {
     _lookup    = MembershipType.CollectAll();
     _viewModel = new MembershipTypeViewModel {
         Collection = MembershipType.CollectAll()
     };
     DataContext = _viewModel;
 }