enhance: use Click event instead of IsCheckedChanged to reduce the times of calling update filter (#513)
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions

This commit is contained in:
leo 2024-09-25 20:44:25 +08:00
parent a8ce4e6d95
commit 8e31ea9140
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View file

@ -47,8 +47,9 @@
Classes="filter" Classes="filter"
Margin="0,0,8,0" Margin="0,0,8,0"
Background="Transparent" Background="Transparent"
IsCheckedChanged="OnToggleFilter" Click="OnToggleFilterClicked"
IsChecked="{Binding IsFiltered}" IsChecked="{Binding IsFiltered, Mode=TwoWay}"
IsVisible="{Binding !IsFolder}"
ToolTip.Tip="{DynamicResource Text.Filter}"/> ToolTip.Tip="{DynamicResource Text.Filter}"/>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
@ -78,8 +79,8 @@
Classes="filter" Classes="filter"
Margin="0,0,8,0" Margin="0,0,8,0"
Background="Transparent" Background="Transparent"
IsCheckedChanged="OnToggleFilter" Click="OnToggleFilterClicked"
IsChecked="{Binding IsFiltered}" IsChecked="{Binding IsFiltered, Mode=TwoWay}"
ToolTip.Tip="{DynamicResource Text.Filter}"/> ToolTip.Tip="{DynamicResource Text.Filter}"/>
</Grid> </Grid>
</DataTemplate> </DataTemplate>

View file

@ -247,7 +247,7 @@ namespace SourceGit.Views
} }
} }
private void OnToggleFilter(object sender, RoutedEventArgs e) private void OnToggleFilterClicked(object sender, RoutedEventArgs e)
{ {
if (sender is ToggleButton toggle && DataContext is ViewModels.Repository repo) if (sender is ToggleButton toggle && DataContext is ViewModels.Repository repo)
{ {