tomlev

Untitled

Feb 16th, 2012
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private IList<City> _allCities = ...;
  2.  
  3. private IList<Department> _departments;
  4. public IList<Department> Departments
  5. {
  6.     get { return _departments; }
  7. }
  8.  
  9. private Department _selectedDepartment;
  10. public Department SelectedDepartment
  11. {
  12.     get { return _selectedDepartment; }
  13.     set
  14.     {
  15.         _selectedDepartment = value;
  16.         OnPropertyChanged("SelectedDepartment");
  17.         OnPropertyChanged("Cities");
  18.     }
  19. }
  20.  
  21. private IList<City> _cities;
  22. public IList<City> Cities
  23. {
  24.     get
  25.     {
  26.         if (_selectedDepartment != null)
  27.         {
  28.             return _cities.Where(c => c.Department == _selectedDepartment).ToList();
  29.         }
  30.         return _allCities;
  31.     }
  32. }
RAW Paste Data