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
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για