From 8e31ea9140bcd831951c722885b6ff49a6d9cc30 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 25 Sep 2024 20:44:25 +0800 Subject: [PATCH] enhance: use `Click` event instead of `IsCheckedChanged` to reduce the times of calling update filter (#513) --- src/Views/TagsView.axaml | 9 +++++---- src/Views/TagsView.axaml.cs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Views/TagsView.axaml b/src/Views/TagsView.axaml index a66f4728..c0837dac 100644 --- a/src/Views/TagsView.axaml +++ b/src/Views/TagsView.axaml @@ -47,8 +47,9 @@ Classes="filter" Margin="0,0,8,0" Background="Transparent" - IsCheckedChanged="OnToggleFilter" - IsChecked="{Binding IsFiltered}" + Click="OnToggleFilterClicked" + IsChecked="{Binding IsFiltered, Mode=TwoWay}" + IsVisible="{Binding !IsFolder}" ToolTip.Tip="{DynamicResource Text.Filter}"/> @@ -78,8 +79,8 @@ Classes="filter" Margin="0,0,8,0" Background="Transparent" - IsCheckedChanged="OnToggleFilter" - IsChecked="{Binding IsFiltered}" + Click="OnToggleFilterClicked" + IsChecked="{Binding IsFiltered, Mode=TwoWay}" ToolTip.Tip="{DynamicResource Text.Filter}"/> diff --git a/src/Views/TagsView.axaml.cs b/src/Views/TagsView.axaml.cs index ea47876e..29b591fb 100644 --- a/src/Views/TagsView.axaml.cs +++ b/src/Views/TagsView.axaml.cs @@ -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) {