Fix text filter if there is whitespace in the text, simplified some events

This commit is contained in:
Daniel Schick 2024-10-17 07:42:36 +02:00
parent 11098da25b
commit bac3421a64
2 changed files with 3 additions and 16 deletions

View File

@ -89,8 +89,7 @@
<ColumnDefinition Width="30" /> <ColumnDefinition Width="30" />
<ColumnDefinition Width=".5*" /> <ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<xctk:WatermarkTextBox x:Name="textBoxSearch" Grid.Column="0" Margin="2" Watermark="{x:Static p:Resources.textEnterKeyword}" PreviewTextInput="textBoxSearch_PreviewTextInput" <xctk:WatermarkTextBox x:Name="textBoxSearch" Grid.Column="0" Margin="2" Watermark="{x:Static p:Resources.textEnterKeyword}" TextChanged="textBoxSearch_TextChanged" />
DataObject.Pasting="textBoxSearch_Pasting" TextChanged="textBoxSearch_TextChanged" />
<CheckBox x:Name="checkBoxOwn" VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Right" Margin="2" Checked="checkBoxOwn_Checked" Unchecked="checkBoxOwn_Checked" /> <CheckBox x:Name="checkBoxOwn" VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Right" Margin="2" Checked="checkBoxOwn_Checked" Unchecked="checkBoxOwn_Checked" />
<Label Content="{x:Static p:Resources.textMineOnly}" Grid.Column="2" /> <Label Content="{x:Static p:Resources.textMineOnly}" Grid.Column="2" />
</Grid> </Grid>

View File

@ -183,23 +183,11 @@ namespace BreCalClient
foreach (Participant agency in comboBoxAgencies.SelectedItems) foreach (Participant agency in comboBoxAgencies.SelectedItems)
_model.Agencies.Add(agency.Id); _model.Agencies.Add(agency.Id);
SearchFilterChanged?.Invoke(); SearchFilterChanged?.Invoke();
} }
private void textBoxSearch_Pasting(object sender, System.Windows.DataObjectPastingEventArgs e)
{
this.SearchFilter.SearchString = e.SourceDataObject.ToString();
SearchFilterChanged?.Invoke();
}
private void textBoxSearch_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
this.SearchFilter.SearchString = this.textBoxSearch.Text + e.Text;
SearchFilterChanged?.Invoke();
}
private void textBoxSearch_TextChanged(object sender, TextChangedEventArgs e) private void textBoxSearch_TextChanged(object sender, TextChangedEventArgs e)
{ {
this.SearchFilter.SearchString = this.textBoxSearch.Text; this.SearchFilter.SearchString = this.textBoxSearch.Text.Trim();
SearchFilterChanged?.Invoke(); SearchFilterChanged?.Invoke();
} }