WPF: Content Presenter


In WPF Content Presenter is a control that displays a single piece of content.

CONTENT PRESENTER: Content Presenter in WPF is used inside control templates, as well as inside the root application markup. The concept of ContentPresenter is quite simple – it is a placeholder for any XAML content and it can be used to insert content at runtime. Or we can say that ContentPresenter is a class that will automatically take the content of the ContentControl and display it, when placed into a ContentControl's ControlTemplate.

A content presenter is used via the ContentPresenter element:
<ContentPresenter></ContentPresenter>

Syntax:

<
ContentPresenter Name="MyContent">
   <ContentPresenter.Content>
      <Button>Click Me</Button>
   </ContentPresenter.Content>
</ContentPresenter>
Ebook Download
View all
Learn
View all
F11Research & Development, LLC