Skip to main content

Microsoft Silverlight

Answered Question Custom Rows for Silverlight DataGridRSS Feed

(0)

Maddes
Maddes

Member

Member

1 points

6 Posts

Custom Rows for Silverlight DataGrid

I would like to add a custom header (individual filters for every column) and a footer row to the Silverlight DataGrid. The columns of these custom-rows should react to the standard resize-function of the columns and scroll within the table. My actual solution is to put these custom things into the table control template, but this way it's not possible to make them scroll or react to column resizing. When I put something into the header-template it's impossible to have individual filters and it seems i cannot edit the RowPresenter template. Thanks in advance for answers.

shamrat231
shamrat231

Contributor

Contributor

4677 points

595 Posts

Answered Question

Re: Custom Rows for Silverlight DataGrid

Maddes:
I would like to add a custom header (individual filters for every column) and a footer row to the Silverlight DataGrid

[custom header] well i am showing a simple example on how to customize the header for a single column

 <UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 

xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  x:Class="SilverlightApplication1.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SilverlightApplication1"
    xmlns:prim="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
    >
    <Grid x:Name="LayoutRoot" Background="Azure">
        <data:DataGrid x:Name="dgApartmentsStatus" GridLinesVisibility="All" >
            <data:DataGrid.Columns>
                <data:DataGridTextColumn Binding="{Binding Path=Apartment}" >
                <data:DataGridTextColumn.HeaderStyle>
                    <Style TargetType="prim:DataGridColumnHeader">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <TextBlock  Text="My Apartment" TextAlignment="Center" Width="200"  />
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </data:DataGridTextColumn.HeaderStyle>
                </data:DataGridTextColumn>
            </data:DataGrid.Columns>
        </data:DataGrid>
    </Grid>
</UserControl>

see if this helps

[custom footer] http://silverlight.net/forums/t/56897.aspx

Sharker Khaleed Mahmud
Software Developer
(MCP,MCTS,MCPD[web])

This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.

Dhaka, Bangladesh
LinkedIn :: SL Profile :: Blog

raz0rf1sh
raz0rf1sh

Member

Member

6 points

6 Posts

Re: Custom Rows for Silverlight DataGrid

Any luck implementing a footer?

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities