## Search sort
# все что добавилось с прошлой работы:
это xaml
```
```
это mainwindow xaml .cs
```
private string searchFilter = "";
private void SearchFilter_KeyUp(object sender, KeyEventArgs e)
{
searchFilter = SearchFilterTextBox.Text;
Invalidate();
}
public IEnumerable WorkerList
{
get
{
var res = _WorkerList;
res = res
.Where(c => (c.Pos == selectedPos || selectedPos == "Должность"))
.Where(c => (selectedAge == null || (c.Age >= selectedAge.AgeFrom && c.Age < selectedAge.AgeTo)))
.Where(c => (c.Sex == selectedSex || selectedSex == "Пол"));
if (searchFilter != "")
res = res.Where(c => c.name.IndexOf(
searchFilter,
StringComparison.OrdinalIgnoreCase) >= 0);
if (sortAsc) res = res.OrderBy(c => c.Age);
else res = res.OrderByDescending(c => c.Age);
return res;
}
set
{
_WorkerList = value;
}
}
```
![](./img/2.png)