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 880261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:04:06+00:00 2026-05-15T12:04:06+00:00

I want to place a DataGrid inside a HeaderedContentControl but the the DataGrid does

  • 0

I want to place a DataGrid inside a HeaderedContentControl but the the DataGrid does not get a vertical Scrollbar. It appears to be sized to hold all rows at once, the bottom disappearing from view.

If I place the same DataGrid in a Border elelemnt I do get the behaviour I want.

I have reduced it to this minimal example:

<Grid>
    <HeaderedContentControl  Margin="10,10,10,161" >
        <HeaderedContentControl.Header >test</HeaderedContentControl.Header>

        <!-- I want it Here but then no Vertical Scroll-->
        <DataGrid ItemsSource="{Binding Path=AllData}"                      
                  AutoGenerateColumns="True"  />
    </HeaderedContentControl>

    <Border Margin="10,169,10,10">                                
        <!--Here it does scroll -->
        <DataGrid ItemsSource="{Binding Path=AllData}" 
                  AutoGenerateColumns="True"  />
    </Border>                      
</Grid>

A few notes:

  • I couldn’t get it to work using HeaderedContentControl.VerticalContentAlignment
  • this problem is related to this question but I think I’ve broadened it a bit and that there is a better answer.
  • using a ScrollViewer around the DataGrid is not a solution because it scrolls the header out of sight.
  • I am using WPF4
  • 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-15T12:04:07+00:00Added an answer on May 15, 2026 at 12:04 pm

    You’re seeing this behavior because the default template for HeaderedContentControl is using a StackPanel to show its contents. Since the StackPanel takes the size of its children, the DataGrid expands its height to have every of its items shown on the screen without scrollbars. The display is then cropped due to the size of the HeaderedContentControl.

    Changing the template to use a Grid or a DockPanel solves this problem:

    <Style TargetType="{x:Type HeaderedContentControl}">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
            <DockPanel>
              <ContentPresenter DockPanel.Dock="Top" ContentSource="Header" />
              <ContentPresenter />
            </DockPanel>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to place my properties files in some folder, but I am not
I want place ads in my website, but I'm unsure about the common practices
I want to place this UserControl at Canvas.Left=168, Canvas.Top=213. However, the control appears at
I want to place a variable number of HTML lists side by side inside
I want to dispaly column in datagrid view using custom query statement but i
I want to add a view inside a FrameLayout programmatically and to place it
I want to place a Webpart on a page that holds a subfolder of
I have a div 200 x 200 px. I want to place a 50
I want to add a comma in the thousands place for a number. Would
I have an ObservableCollection feeding a DataGrid thats updating nicely. The point: I want

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.