Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7758843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:28:18+00:00 2026-06-01T13:28:18+00:00

I am just started learning silverlight and it’s controls. I am pretty much sure

  • 0

I am just started learning silverlight and it’s controls. I am pretty much sure we can create this kind of headers for datagrid using silverlight too like other technologies like JQuery and Flex. But i am not sure how to do it. Can somebody suggest some examples or sites where i can learn to customize the headers like this?

   _______________________________________________________
   |       Name          |   Age     |        Marks      |
   |_____________________|           |___________________|
   |First Name| Last Name|           |Sub1 | Sub2  |Sub3 |
   |_____________________|___________|___________________|
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:28:19+00:00Added an answer on June 1, 2026 at 1:28 pm

    Try This Code In Xaml:

       <UserControl  x:Class="SilverlightApplication16.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
        xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
    
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <Style x:Key="DataGridBaseHeaderStyle"    
               TargetType="dataprimitives:DataGridColumnHeader">
            <Setter Property="FontWeight" Value="Bold" />
        </Style>
        <Style x:Key="NameHeaderStyle"   TargetType="dataprimitives:DataGridColumnHeader"     
               BasedOn="{StaticResource DataGridBaseHeaderStyle}">
            <Setter Property="Foreground" Value="#FF000000"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="SeparatorBrush" Value="#FFC9CACA"/>
            <Setter Property="Padding" Value="8"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid x:Name="Root">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Rectangle x:Name="BackgroundRectangle" Fill="#FF1F3B53" Stretch="Fill" Grid.ColumnSpan="2"/>
                            <Rectangle x:Name="BackgroundGradient" Stretch="Fill" Grid.ColumnSpan="2">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                                        <GradientStop Color="#FCFFFFFF" Offset="0.015"/>
                                        <GradientStop Color="#F7FFFFFF" Offset="0.375"/>
                                        <GradientStop Color="#E5FFFFFF" Offset="0.6"/>
                                        <GradientStop Color="#D1FFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20" />
                                    <RowDefinition Height="1" />
                                    <RowDefinition Height="20" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="1" />
                                    <ColumnDefinition Width="100"/>
                                </Grid.ColumnDefinitions>
                                <!-- Row 0 -->
                                <ContentPresenter Content="Name"                                       
                                                  VerticalAlignment="Center" HorizontalAlignment="Center"                                        Grid.ColumnSpan="3" />
                                <!-- Row 1 -->
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Height="1"                                 Visibility="Visible" Grid.Row="1" Grid.ColumnSpan="3" />
                                <!-- Row 2 -->
                                <ContentPresenter Content="First Name " Grid.Row="2" VerticalAlignment="Center"                                        HorizontalAlignment="Center" />
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1"                                  Visibility="Visible" Grid.Row="2" Grid.Column="1" />
                                <ContentPresenter Content="Last Name" Grid.Row="2" Grid.Column="2"                                        VerticalAlignment="Center" HorizontalAlignment="Center" />
                            </Grid>
                            <Rectangle x:Name="VerticalSeparator" Fill="#FFC9CACA"                           
                                       VerticalAlignment="Stretch" Width="1" Visibility="Visible"               
                                       Grid.Row="1" Grid.Column="1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="MarkHeaderStyle"   TargetType="dataprimitives:DataGridColumnHeader"     BasedOn="{StaticResource DataGridBaseHeaderStyle}">
            <Setter Property="Foreground" Value="#FF000000"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="SeparatorBrush" Value="#FFC9CACA"/>
            <Setter Property="Padding" Value="8"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid x:Name="Root">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Rectangle x:Name="BackgroundRectangle" Fill="#FF1F3B53" Stretch="Fill" Grid.ColumnSpan="2"/>
                            <Rectangle x:Name="BackgroundGradient" Stretch="Fill" Grid.ColumnSpan="2">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                                        <GradientStop Color="#FCFFFFFF" Offset="0.015"/>
                                        <GradientStop Color="#F7FFFFFF" Offset="0.375"/>
                                        <GradientStop Color="#E5FFFFFF" Offset="0.6"/>
                                        <GradientStop Color="#D1FFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" >
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20" />
                                    <RowDefinition Height="1" />
                                    <RowDefinition Height="20" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="1" />
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="1" />
                                    <ColumnDefinition Width="100"/>
                                </Grid.ColumnDefinitions>
                                <!-- Row 0 -->
                                <ContentPresenter Content="Marks"                                        VerticalAlignment="Center" HorizontalAlignment="Center"                                        Grid.ColumnSpan="6" />
                                <!-- Row 1 -->
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Height="1"                                 Visibility="Visible" Grid.Row="1" Grid.ColumnSpan="5" />
                                <!-- Row 2 -->
                                <ContentPresenter Content="Sub1" Grid.Row="2" VerticalAlignment="Center"                                        HorizontalAlignment="Center" />
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1"                                  Visibility="Visible" Grid.Row="2" Grid.Column="1" />
                                <ContentPresenter Content="Sub2" Grid.Row="2" Grid.Column="2"                                        VerticalAlignment="Center" HorizontalAlignment="Center" />
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1"                                  Visibility="Visible" Grid.Row="2" Grid.Column="3" />
                                <ContentPresenter Content="Sub3" Grid.Row="2" Grid.Column="4"                                        VerticalAlignment="Center" HorizontalAlignment="Center" />
                            </Grid>
                            <Rectangle x:Name="VerticalSeparator" Fill="#FFC9CACA"                            
                                       VerticalAlignment="Stretch" Width="1" Visibility="Visible"                      
                                       Grid.Row="1" Grid.Column="1"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <sdk:DataGrid AutoGenerateColumns="False" Height="100" HorizontalAlignment="Left" Margin="12,101,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="598">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTemplateColumn Header="Tue" HeaderStyle="{StaticResource NameHeaderStyle}">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBox Text="{Binding FistName}"/>
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1" />
                                <TextBox Text="{Binding LastName}" Margin="2,0,0,0"/>
                            </StackPanel>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTemplateColumn   HeaderStyle="{StaticResource DataGridBaseHeaderStyle}" CanUserReorder="True" Header="Age" CanUserResize="True" CanUserSort="True" Width="Auto" />
                <sdk:DataGridTemplateColumn Header="Tue" HeaderStyle="{StaticResource MarkHeaderStyle}">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBox Text="{Binding Subject1}"/>
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1" />
                                <TextBox Text="{Binding Subject2}" Margin="2,0,0,0"/>
                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1" />
                                <TextBox Text="{Binding Subject3}" Margin="2,0,0,0"/>
                            </StackPanel>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>
    </Grid>
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started learning C but I don't understand this part of the code.
I just started learning Flex this week, and I cannot get an image path
I just started learning Silverlight by walking through the labs posted on Channel9. When
I just started learning targets, and have followed all the instructions to create my
Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I just started learning RoR. This is my /app/trip_controller.rb file class TripController < ApplicationController
I just started learning C++ couple of weeks ago. So now I have this
I've just started learning Silverlight and I learned it is a client side program.
Just started learning Haskell. I have an empty source file with this inside: pe
I just started learning some ruby, and I want to do something like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.