Skip to main content

Microsoft Silverlight

Answered Question DataGrid footerRSS Feed

(0)

novy
novy

Member

Member

2 points

17 Posts

DataGrid footer

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
silverbyte

Participant

Participant

1338 points

405 Posts

Answered Question

Re: DataGrid footer

 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

Please click on 'Mark as answer' near my comment if you feel I answered your question.

novy
novy

Member

Member

2 points

17 Posts

Re: DataGrid footer

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
yifung

Contributor

Contributor

3313 points

540 Posts

Microsoft
Answered Question

Re: DataGrid footer

Sure, as long as there's a public Count property on your collection and you set the DataContext of the TextBlock to it

Yifung Lin [MSFT]

raz0rf1sh
raz0rf1sh

Member

Member

6 points

6 Posts

Re: DataGrid footer

Any luck with this? You'd think they would just expose a FooterTemplate or something along those lines.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities