ContentControl
The ContentControl displays data according to a data template.
最后更新于
这有帮助吗?
The ContentControl displays data according to a data template.
最后更新于
这有帮助吗?
Content
The content to display in the control
At its simplest, a ContentControl
displays the data assigned to its property.
For example:
Will display the string "Hello World!". The Content
property is the control's default property and so the above example can also be written as:
If you assign a control to a ContentControl
then it will display the control, for example:
We can display the student's first and last name in a ContentControl
using the ContentTemplate
property:
So far so uninteresting. Where ContentControl
becomes useful is in tandem with and . By setting the property one can specify how the data in the Content
property is displayed. For example given the following view models:
Note: The following examples assume an instance of MainWindowVieModel
is assigned to the Window's DataContext
. See for more information.
For more information see the section.