Bez popisu

aleukhin 90ca23d239 1st com před 6 měsíci
.vs 90ca23d239 1st com před 6 měsíci
WpfApp1 90ca23d239 1st com před 6 měsíci
img 90ca23d239 1st com před 6 měsíci
WpfApp1.sln 90ca23d239 1st com před 6 měsíci
readme.md 90ca23d239 1st com před 6 měsíci

readme.md

Search sort

все что добавилось с прошлой работы:

это xaml

        </ComboBox>
        <RadioButton
GroupName="Price"
Tag="2"
Content="Старше"
Checked="RadioButton_Checked"
VerticalAlignment="Center" RenderTransformOrigin="0.067,0.44"/>
        <RadioButton
GroupName="Price"
Tag="1"
Content="Младше"
IsChecked="True"
Checked="RadioButton_Checked"
VerticalAlignment="Center" Height="15" Width="69"/>
        <Label 
Content="Искать" 
VerticalAlignment="Center"/>
        <TextBox
Width="200"
VerticalAlignment="Center"
x:Name="SearchFilterTextBox" 
KeyUp="SearchFilter_KeyUp"/>


это mainwindow xaml .cs

private string searchFilter = ""; 

private void SearchFilter_KeyUp(object sender, KeyEventArgs e)
{
    searchFilter = SearchFilterTextBox.Text;
    Invalidate();
}

public IEnumerable<Worker> 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;
    }
}