Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
my list view contains 2 GridViewColumn one is a category and another one is extension
in the category need to have parent like eg Application in those child contains NotePad,VLC etc in the extension it contains .exe like the same next parent in down need to be like Audio in those child contains all the audio files how to achiever those things soory if i am not asked clearly

What I have tried:

<ListView x:Name="ListViewSetting" BorderBrush="#efefef" Width="650" Height="310" ItemsSource="{Binding ChildrenList}" Background="#F9F9F9" >
                       <ListView.View>
                           <GridView>

                               <GridViewColumn  CellTemplate="{StaticResource myCellTemplateMonth}"  Width="400" >
                                   <GridViewColumn.Header  >
                                       <GridViewColumnHeader  Template="{StaticResource CustomHeaderForName}" Margin="-3,0,0,0" Tag="Category"   BorderThickness="0"  Width="auto" Height="40"  />
                                   </GridViewColumn.Header>
                               </GridViewColumn>

                               <GridViewColumn  CellTemplate="{StaticResource myCellTemplateSize}" Width="260" >
                                   <GridViewColumn.Header  >


                                       <GridViewColumnHeader Margin="0,0,0,0"  Tag="File extension" Template="{StaticResource CustomHeader}"  BorderThickness="0"  Width="auto" Height="40" />


                                   </GridViewColumn.Header>
                               </GridViewColumn>

                           </GridView>
                       </ListView.View>

                       <ListView.GroupStyle>
                           <GroupStyle>
                               <GroupStyle.HeaderTemplate>
                                   <DataTemplate>
                                       <TextBlock  FontSize="20" FontWeight="Bold" Text="{Binding FileName}"  >  </TextBlock>
                                   </DataTemplate>
                               </GroupStyle.HeaderTemplate>
                           </GroupStyle>
                       </ListView.GroupStyle>
                   </ListView>
Posted
Comments
Maciej Los 22-Jun-21 16:51pm    
[no name] 23-Jun-21 12:13pm    
I usually use user controls in my ListView. To show a hierarchy, I vary the left Margin (or something), so that the items "indent" based on the "level"; e.g. Works (0), Book (1), Chapter (2), Section (3), etc. To expand / collapse, I show / hide everything under a given level #.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900