Click here to Skip to main content
15,867,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello friends currently i am working on Data grid in uwp

i have created the grid view but i don't know how to add the selcect all checkbox as header in uwp xamarin

the code which i have tried it display datagrid perfectly but i don't know how to add the checkbox at header for select all check box


thanks in advance have a great day.

What I have tried:

<controls:DataGrid AutoGenerateColumns="False"    CanUserResizeColumns="False" IsReadOnly="True" Margin="0,28,0,0" Name="UserListView" VerticalScrollBarVisibility="Auto"  UseLayoutRounding="False" HorizontalScrollBarVisibility="Auto" TabIndex="4" FontSize="14" Background="White" Grid.Column="2"  Grid.Row="3"
        HeadersVisibility="Column"   SelectedIndex="0" HorizontalGridLinesBrush="#FFC5C5CA" IsTabStop="True"  Grid.ColumnSpan="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

         <controls:DataGrid.Columns >

                          <controls:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False"  Header="Name"  Width="350"  >
                 <controls:DataGridTemplateColumn.CellTemplate >
                     <DataTemplate>
                         <TextBlock>
                             <Run Text="{Binding userPrefix}" />
                             <Run Text="{Binding userFirstName}" />
                             <Run Text="{Binding userLastName}" />
                         </TextBlock>
                     </DataTemplate>
                 </controls:DataGridTemplateColumn.CellTemplate>
             </controls:DataGridTemplateColumn>

             <controls:DataGridTextColumn  CanUserResize="False"  Header="Email" Binding="{Binding userEmail}"  Width="300"  />

             <controls:DataGridTemplateColumn CanUserReorder="False" CanUserResize="False"  Header="Phone" Width="250" >
                 <controls:DataGridTemplateColumn.CellTemplate >
                     <DataTemplate>
                         <TextBlock>
                             <Run Text="{Binding userExt}" />
                             <Run Text="-" />
                             <Run Text="{Binding userPhone}" />
                         </TextBlock>
                     </DataTemplate>
                 </controls:DataGridTemplateColumn.CellTemplate>
             </controls:DataGridTemplateColumn>


             <controls:DataGridTemplateColumn Tag="Col" Header="Edit">
                 <controls:DataGridTemplateColumn.CellTemplate >
                     <DataTemplate>
                         <Button  Name="UpdateGridRecord">
                             <Button.Background>
                                 <ImageBrush ImageSource="logo.png" />
                             </Button.Background>
                         </Button>
                     </DataTemplate>
                 </controls:DataGridTemplateColumn.CellTemplate>
             </controls:DataGridTemplateColumn>

         </controls:DataGrid.Columns>
     </controls:DataGrid>
Posted
Updated 2-Aug-19 0:43am

1 solution

Use the columns' "Header" object to put "stuff" in the header.

The header is / was typically used to show an up or down glyph when sorting a column "after clicking the header".

Some other convention was to simply "select all" when you "clicked" the header.

You have a new "pattern".
 
Share this answer
 

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