Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of HeaderedContentControl in wpf?

Tags:

wpf

xaml

I am working on WPF but the UI is localized for the Gujarati language. In my window.xaml I have 2 rows and 2 columns.

I could not get use of the HeaderedContentControl tag. The code is here:

<Border
            Grid.Row="1" Grid.Column="1"
            Style="{StaticResource MainBorderStyle}"
            Padding="0"
            BorderThickness="0,0,0,1"
            Background="#f9f9f9">
            <HeaderedContentControl
                VerticalContentAlignment="Stretch"
                Content="{Binding Path=CurrentWorkspace}"
                Style="{StaticResource MainWorkspaceStyle}"
                ContentTemplate="{StaticResource WorkspaceTemplate}"/>
        </Border>

Please explain it and also explain role of content template.

like image 745
prjndhi Avatar asked May 16 '12 03:05

prjndhi


1 Answers

A HeaderedContentControl is a control that displays other controls, but also provides a header for that (like a GroupBox or window title).

The HeaderedContentControl is bound to a set of data-- in this case "CurrentWorkspace".

The ContentTemplate describes how that data should be displayed. In this particular case, it is something called "WorkspaceTemplate", which will be defined as a Static Resource somewhere in the project-- either in a resource XAML file, or, perhaps in your window, under <Window.Resources> at the top of the XAML.

No matter where it is, if you search through your entire solution for WorkspaceTemplate you should eventually see where it is defined.

like image 150
Robaticus Avatar answered Oct 04 '22 02:10

Robaticus