ContentPresenter.ContentSource Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the base name to use during automatic aliasing.
public:
property System::String ^ ContentSource { System::String ^ get(); void set(System::String ^ value); };
public string ContentSource { get; set; }
member this.ContentSource : string with get, set
Public Property ContentSource As String
Property Value
The base name to use during automatic aliasing. The default is "Content".
Examples
The following example shows a style for a HeaderedContentControl that demonstrates the usage of the ContentSource property:
<Style TargetType="HeaderedContentControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type HeaderedContentControl}">
<StackPanel>
<Grid>
<Rectangle Stroke="{TemplateBinding Background}"/>
<ContentPresenter ContentSource="Header"/>
</Grid>
<Grid>
<Rectangle Fill="{TemplateBinding Background}"/>
<ContentPresenter ContentSource="Content"/>
</Grid>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Remarks
This property should only be used when the ContentPresenter is in a template. When a template contains a ContentPresenter with ContentSource set to "Abc
", the Content, ContentTemplate, and ContentTemplateSelector properties of the ContentPresenter are automatically aliased to Abc
, AbcTemplate
, and AbcTemplateSelector
, respectively. Beginning with the .NET Framework 3.5 Service Pack 1, setting ContentSource to "Abc
" also causes the ContentStringFormat property to be aliased to AbcStringFormat
.
The two most useful values for this property are "Content" and "Header".
Dependency Property Information
Identifier field | ContentSourceProperty |
Metadata properties set to true |
None |
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om