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

  • Home
  • SEARCH
  • 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 6380263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:14:45+00:00 2026-05-25T02:14:45+00:00

I have the following code: <Window.Resources> <DataTemplate x:Key=SectionTemplate > <TextBlock Text={Binding Path=Name} /> </DataTemplate>

  • 0

I have the following code:

 <Window.Resources>      
       <DataTemplate x:Key="SectionTemplate" >                          
              <TextBlock Text="{Binding Path=Name}" />                  
       </DataTemplate>
 </Window.Resources>
 <Grid >        
   <Border>
       <HeaderedItemsControl Header="Top1"
                             ItemsSource="{Binding Path=List1}" 
                             ItemTemplate="{StaticResource SectionTemplate}"/>
    </Border>       
 </Grid>
public class MainWindow
{
   public List<Item> List1
   {
      get { return list1; }
      set { list1 = value; }
   }

   public MainWindow()
   {             
      list1.Add(new Item { Name = "abc" });
      list1.Add(new Item { Name = "xxx" });

      this.DataContext = this;      
      InitializeComponent();       
   }   
}

public class Item
{     
    public string Name { get; set; }
}

For some reason the Items are rendered, but without the header.

  • 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-05-25T02:14:46+00:00Added an answer on May 25, 2026 at 2:14 am

    As the documentation points out:

    A HeaderedItemsControl has a limited default style. To create a HeaderedItemsControl with a custom appearance, create a new ControlTemplate.

    So when you create that template make sure to include some ContentPresenter which is bound to the Header (e.g. using ContentSource)

    e.g.

    <HeaderedItemsControl.Template>
        <ControlTemplate TargetType="{x:Type HeaderedItemsControl}">
            <Border>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <ContentPresenter ContentSource="Header" />
                    <Separator Grid.Row="1" />
                    <ItemsPresenter Grid.Row="2" />
                </Grid>
            </Border>                       
        </ControlTemplate>
    </HeaderedItemsControl.Template>
    

    (All the default bindings (Margin, Background, etc.) are omitted.)

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

Sidebar

Related Questions

In <Window.Resources> I have defined following style: <Style x:Key=textBlockStyle TargetType=TextBlock> <Setter Property=Margin Value=5,0,5,0/> </Style>
I have the following XAML: <Grid x:Name=root> <Grid.RowDefinitions> <RowDefinition Height=*/> <RowDefinition Height=Auto/> </Grid.RowDefinitions> <Grid.Resources>
I have the following test case xaml. <Window.Resources> <XmlDataProvider x:Key=testDS1> <x:XData> <root xmlns=> <item>1</item>
I have the following XAML: <Window.Resources> <myApp:ImageDisplayConvertor x:Key=ImageDisplayConvertor /> </Window.Resources> <DataGridTemplateColumn Header=Icon> <DataGridTemplateColumn.CellTemplate >
I have the following code to take screenshots of a window: HDC WinDC; HDC
I have the following code to take a screenshot of a window, and get
I have the following JavaScript code to pop up a window in Internet Explorer.
I have the following C# code to launch an outlook window. The one think
In my MainWindow.xaml, I have the following reference to a ResourceDictionary: <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries>
I have the following code: ProcessStartInfo si = new ProcessStartInfo(./Resources/pdftk.exe, executionstring); Process myproc =

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.