wpf中HeaderedContentControl有什么用? [英] What is the use of HeaderedContentControl in wpf?
问题描述
我正在开发 WPF,但 UI 已针对古吉拉特语进行了本地化.在我的 window.xaml 中,我有 2 行和 2 列.
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.
我无法使用 HeaderedContentControl 标签.代码在这里:
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.
推荐答案
HeaderedContentControl
是一个显示其他控件的控件,但也为其提供了一个标题(如 GroupBox
代码>或窗口标题).
A HeaderedContentControl
is a control that displays other controls, but also provides a header for that (like a GroupBox
or window title).
HeaderedContentControl
绑定到一组数据——在本例中为CurrentWorkspace".
The HeaderedContentControl
is bound to a set of data-- in this case "CurrentWorkspace".
ContentTemplate
描述了数据应该如何显示.在这种特殊情况下,它被称为WorkspaceTemplate",它将被定义为项目中某处的静态资源——在资源 XAML 文件中,或者在您的窗口中,
在 XAML 的顶部.
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.
无论它在哪里,如果您在整个解决方案中搜索 WorkspaceTemplate
,您最终应该会看到它的定义位置.
No matter where it is, if you search through your entire solution for WorkspaceTemplate
you should eventually see where it is defined.
这篇关于wpf中HeaderedContentControl有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!