特定のデータ型とその要素が与えられた場合、バインドされた要素に自動的に適用されるテンプレートをコードで決定する必要があります。
カスタム ロジックに基づいて特定のオブジェクトに使用するテンプレートを UIに伝えるために使用される DataTemplateSelector は探していません。代わりに、特定のデータ型と UI 要素にどのテンプレートを使用するかを UI に問い合わせています。
つまり、ウィンドウのリソース セクションで定義されたテンプレートに基づいて WPF が適用するものを探しています。これは、そのウィンドウのコントロールのリソースによってオーバーライドでき、DataTemplate または DataTemplate を明示的に設定することでオーバーライドできます。その要素に DataTemplateSelector を直接提供します。
また、SelectTemplate のデフォルトの実装を試しましたが、null が返されるため、そのルートにも進むことができません。
テストは、UI のどこにもデータ テンプレートまたはセレクターが定義されていない要素に「この値をどのように表示しますか?」と尋ねることです。うまくいけば、Text プロパティがそのオブジェクトの ToString メソッドに設定された TextBlock の定義を含む DataTemplate が返されます。これは、他に何も定義されていない場合にデフォルトで表示されるものです。