ContentPresenter.ChooseTemplate Method
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.
Returns the template to use. This may depend on the content or other properties.
protected:
virtual System::Windows::DataTemplate ^ ChooseTemplate();
protected virtual System.Windows.DataTemplate ChooseTemplate ();
abstract member ChooseTemplate : unit -> System.Windows.DataTemplate
override this.ChooseTemplate : unit -> System.Windows.DataTemplate
Protected Overridable Function ChooseTemplate () As DataTemplate
Returns
The DataTemplate to use.
Remarks
The base class implements the following rules:
If ContentTemplate is set, use it.
If ContentTemplateSelector is set, call its SelectTemplate method. If the result is not
null
, use it.Look for a DataTemplate whose DataType matches the content among the resources known to the ContentPresenter (including application, theme, and system resources). If one is found, use it.
If the type of Content is "common", use a standard template. The common types are
String
, XmlNode, and UIElement.Otherwise, use a default template that essentially converts Content to a string and displays it in a TextBlock.
Derived classes can override these rules and implement their own.
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示