Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit DataGrid footer
4 replies. Latest Post by raz0rf1sh on June 30, 2009.
(0)
novy
Member
2 points
17 Posts
12-10-2008 2:34 AM |
I want to add footer to datagrid control for example to show number of rows in datagrid.
Is the only way to create new control template?
silverbyte
Participant
1338 points
405 Posts
12-10-2008 3:08 AM |
why don't you just create a UserControl with a StackPanel holding DataGrid and a simple TextBlock:
<UserControl ... >
<StackPanel Orientation="Horizontal">
<data:DataGrid>
....
</data:DataGrid>
<TextBlock x:Name="footer" />
</StackPanel>
</UserControl>
you can compute and set the text of the footer in code
12-12-2008 7:05 AM |
In this case, If I set DataContext to some collection on my UserControl how should I set Text property on TextBlock.
Is this ok?
<TextBlock x:Name="footer" Text={Binding Path=Count}/>
yifung
Contributor
3313 points
540 Posts
12-12-2008 7:23 PM |
Sure, as long as there's a public Count property on your collection and you set the DataContext of the TextBlock to it
raz0rf1sh
6 points
6 Posts
06-30-2009 9:35 AM |
Any luck with this? You'd think they would just expose a FooterTemplate or something along those lines.