ContentPresenter.ContentSource Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta il nome di base da utilizzare durante l'aliasing automatico.
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
Valore della proprietà
Nome di base da usare durante l'aliasing automatico. Il valore predefinito è "Content".
Esempio
Nell'esempio seguente viene illustrato uno stile per un HeaderedContentControl oggetto che illustra l'utilizzo della ContentSource proprietà :
<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>
Commenti
Questa proprietà deve essere utilizzata solo quando si ContentPresenter trova in un modello. Quando un modello contiene un ContentPresenter oggetto con ContentSource impostato su "Abc", le Contentproprietà , ContentTemplatee ContentTemplateSelector di ContentPresenter vengono automaticamente impostate rispettivamente su Abc, AbcTemplatee AbcTemplateSelector. A partire da .NET Framework 3.5 Service Pack 1, l'impostazione ContentSource su "Abc" comporta anche l'alias della ContentStringFormat proprietà su AbcStringFormat.
I due valori più utili per questa proprietà sono "Content" e "Header".
Informazioni sulle proprietà di dipendenza
| Elemento | Valore |
|---|---|
| Campo Identificatore | ContentSourceProperty |
Proprietà dei metadati impostate su true |
Nessuno |