From 250ff69c65957c1ad3f5f336aa379ec1464fea00 Mon Sep 17 00:00:00 2001
From: Waheed Ahmad <ewammuslim@outlook.com>
Date: Thu, 21 Nov 2024 18:44:00 +0500
Subject: [PATCH] use ListView to host filter items

---
 .../Themes/TableViewColumnHeader.xaml         | 41 ++++++++++++-------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/WinUI.TableView/Themes/TableViewColumnHeader.xaml b/src/WinUI.TableView/Themes/TableViewColumnHeader.xaml
index 6d0ab5d..bbadcd1 100644
--- a/src/WinUI.TableView/Themes/TableViewColumnHeader.xaml
+++ b/src/WinUI.TableView/Themes/TableViewColumnHeader.xaml
@@ -170,24 +170,35 @@
                                                                     BorderThickness="0,0,0,1"
                                                                     BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}">
                                                                 <CheckBox x:Name="SelectAllCheckBox"
-                                                                          Margin="12,8,12,0"
+                                                                          Margin="12,8,12,1"
                                                                           IsThreeState="True"
                                                                           Content="(Select All)" />
                                                             </Border>
-                                                            <ScrollViewer Grid.Row="2"
-                                                                          Padding="12,0"
-                                                                          VerticalScrollMode="Enabled">
-                                                                <ItemsControl ItemsSource="{Binding FilterItems}">
-                                                                    <ItemsControl.ItemTemplate>
-                                                                        <DataTemplate>
-                                                                            <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}">
-                                                                                <TextBlock Text="{Binding Value}"
-                                                                                           TextWrapping="NoWrap" />
-                                                                            </CheckBox>
-                                                                        </DataTemplate>
-                                                                    </ItemsControl.ItemTemplate>
-                                                                </ItemsControl>
-                                                            </ScrollViewer>
+                                                            <ListView Grid.Row="2"
+                                                                      SelectionMode="None"
+                                                                      ItemsSource="{Binding FilterItems}">
+                                                                <ListView.ItemContainerStyle>
+                                                                    <Style TargetType="ListViewItem"
+                                                                           BasedOn="{StaticResource DefaultListViewItemStyle}">
+                                                                        <Setter Property="Padding"
+                                                                                Value="12,0" />
+                                                                        <Setter Property="Margin"
+                                                                                Value="0" />
+                                                                        <Setter Property="MinHeight"
+                                                                                Value="36" />
+                                                                        <Setter Property="Height"
+                                                                                Value="36" />
+                                                                    </Style>
+                                                                </ListView.ItemContainerStyle>
+                                                                <ListView.ItemTemplate>
+                                                                    <DataTemplate>
+                                                                        <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}">
+                                                                            <TextBlock Text="{Binding Value}"
+                                                                                       TextWrapping="NoWrap" />
+                                                                        </CheckBox>
+                                                                    </DataTemplate>
+                                                                </ListView.ItemTemplate>
+                                                            </ListView>
                                                         </Grid>
                                                     </ControlTemplate>
                                                 </MenuFlyoutItem.Template>