共用方式為


ContentControl.OnContentTemplateSelectorChanged 方法

定義

當 ContentTemplateSelector屬性的值變更時叫用。

void OnContentTemplateSelectorChanged(DataTemplateSelector const& oldContentTemplateSelector, DataTemplateSelector const& newContentTemplateSelector);
protected virtual void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector);
function onContentTemplateSelectorChanged(oldContentTemplateSelector, newContentTemplateSelector)
Protected Overridable Sub OnContentTemplateSelectorChanged (oldContentTemplateSelector As DataTemplateSelector, newContentTemplateSelector As DataTemplateSelector)

參數

oldContentTemplateSelector
DataTemplateSelector

ContentTemplateSelector屬性的舊值。

newContentTemplateSelector
DataTemplateSelector

ContentTemplateSelector屬性的新值。

備註

衍生自 ContentControl 的類別可以覆寫此方法,以執行任何應該套用的自訂邏輯,以防選取器邏輯會根據內容變更自動選擇 DataTemplate

適用於