Skip to content

Commit 8b7d93e

Browse files
committed
Fix: Filter symbol in MultipleChoiceContentFilter not always updated
1 parent aaaaa8f commit 8b7d93e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/DataGridExtensions/MultipleChoiceFilter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ public MultipleChoiceContentFilter(IEnumerable<string?>? items, string? text = n
312312
/// </summary>
313313
public Regex? Regex { get; }
314314

315+
/// <summary>
316+
/// Get a value that indicates if this filter has some filter conditions.
317+
/// </summary>
318+
public bool IsFiltered => Items != null || Regex != null;
319+
315320
/// <inheritdoc />
316321
public virtual bool IsMatch(object? value)
317322
{

src/DataGridExtensions/Themes/Generic.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase">
77

88
<!-- Style for a filter check box. The check box is only visible when it's hovered, focused or has a value. -->
9-
<Style x:Key="{x:Static src:DataGridFilter.ColumnHeaderSearchCheckBoxStyleKey}" TargetType="CheckBox">
9+
<Style x:Key="{x:Static src:DataGridFilter.ColumnHeaderSearchCheckBoxStyleKey}" TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
1010
<Setter Property="IsThreeState" Value="True" />
1111
<Setter Property="Margin" Value="4,0,2,0" />
1212
<Style.Triggers>
@@ -313,8 +313,8 @@
313313
Property="BorderBrush"
314314
Value="Transparent" />
315315
</Trigger>
316-
<DataTrigger Binding="{Binding Path=Filter.Items, RelativeSource={RelativeSource Self}}"
317-
Value="{x:Null}">
316+
<DataTrigger Binding="{Binding Path=Filter.IsFiltered, RelativeSource={RelativeSource Self}}"
317+
Value="False">
318318
<Setter TargetName="IsFilterActiveMarker"
319319
Property="Visibility"
320320
Value="Hidden" />

0 commit comments

Comments
 (0)