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 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기