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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:54:14+00:00 2026-06-09T02:54:14+00:00

<ContentControl Content=Test> <ContentControl.ContentTemplate> <DataTemplate> <Border> <ContentPresenter /> </Border> </DataTemplate> </ContentControl.ContentTemplate> </ContentControl> It throws stackoverflow

  • 0
<ContentControl Content="Test">
    <ContentControl.ContentTemplate>
        <DataTemplate>
            <Border>
                <ContentPresenter />
            </Border>
        </DataTemplate>
    </ContentControl.ContentTemplate>
</ContentControl>

It throws stackoverflow exception. However if i use any other control else than ContentPresenter it works fine even ItemPresenter also works.I knows it doesnt make any sense to have ContentPresenter there but just for Knowledge want to know. Why it throws StackOverFlow exception and also Why does Intellisense shows it can be added(I mean it comes there in Intellisense that means syntatically its not wrong to have ContentPresenter there). Any help will be highly appericiated. Or is it any flaw in Wpf.

  • 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-09T02:54:15+00:00Added an answer on June 9, 2026 at 2:54 am

    The MSDN page for ContentPresenter says:

    When a ContentPresenter object is in a ControlTemplate of a
    ContentControl, the Content, ContentTemplate, and
    ContentTemplateSelector properties get their values from the
    properties of the same names of the ContentControl. You can have the
    ContentPresenter property get the values of these properties from
    other properties of the templated parent by setting the ContentSource
    property or binding to them.

    I imagine it gives a StackOverflow because it just keeps on trying to apply the template to the ContentPresenter in the ContentTemplate, and then on the next one inside it, and then the one inside it, etc.

    You also can do things like the following, so this pattern probably isn’t always wrong, even though IntelliSense probably doesn’t do any checking for these sorts of scenarios.

    <ContentControl Content="Test"> 
        <ContentControl.ContentTemplate> 
            <DataTemplate> 
                <Border> 
                    <ContentPresenter ContentStringFormat="{}{0}" />
                </Border> 
            </DataTemplate> 
        </ContentControl.ContentTemplate> 
    </ContentControl> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight control derived from ContentControl. I use it in following way
I have a ContentControl , which I use the Content Property to place some
How to bind textbox text property, within datatemplate, to ContentControl Content property? (Without bindng
Given the following two options: <ContentControl>Content</ContentControl> vs. <ContentControl Content=Content/> Any performance differences? What would
I have a content control as follows: <ContentControl x:Name=grid1ContentControl Content={Binding MainGridViewModel} /> MainGridViewModel is
I want to create a new custom control derived from ContentControl (it will be
Say I have the following code: ContentControl c = new ContentControl(); c.SetBinding (ContentControl.Content, new
Unsure of the best way to bind a a drop-down list Content Control to
I'm trying to create a login status control in silverlight where I will use
Scenario : I have a ContentControl in my View whose Content property is bound

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.