Sign In|Join
Home/Silverlight.NET Forums/General Silverlight Programming/Silverlight Controls and Silverlight Toolkit/DataGrid footer
Last post Jun 30, 2009 02:35 PM by raz0rf1sh
Member
2 Points
18 Posts
Dec 10, 2008 07:34 AM | LINK
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?
Participant
1392 Points
482 Posts
Dec 10, 2008 08:08 AM | LINK
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
Dec 12, 2008 12:05 PM | LINK
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}/>
Contributor
3937 Points
637 Posts
Microsoft
Dec 13, 2008 12:23 AM | LINK
Sure, as long as there's a public Count property on your collection and you set the DataContext of the TextBlock to it
6 Points
6 Posts
Jun 30, 2009 02:35 PM | LINK
novy
Member
2 Points
18 Posts
DataGrid footer
Dec 10, 2008 07:34 AM | LINK
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
1392 Points
482 Posts
Re: DataGrid footer
Dec 10, 2008 08:08 AM | LINK
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
novy
Member
2 Points
18 Posts
Re: DataGrid footer
Dec 12, 2008 12:05 PM | LINK
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
3937 Points
637 Posts
Microsoft
Re: DataGrid footer
Dec 13, 2008 12:23 AM | LINK
Sure, as long as there's a public Count property on your collection and you set the DataContext of the TextBlock to it
raz0rf1sh
Member
6 Points
6 Posts
Re: DataGrid footer
Jun 30, 2009 02:35 PM | LINK