Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml 为ContentTemplate绑定静态资源_Xaml - Fatal编程技术网

Xaml 为ContentTemplate绑定静态资源

Xaml 为ContentTemplate绑定静态资源,xaml,Xaml,如何基于绑定字符串动态使用模板(这会抱怨静态资源必须是字符串,即使绑定将返回字符串): <ContentControl ContentTemplate="{StaticResource {Binding Template}}"> <ContentPresenter /> </ContentControl> 所以模板实际上只是一个字符串,它将返回要使用的模板

如何基于绑定字符串动态使用模板(这会抱怨静态资源必须是字符串,即使绑定将返回字符串)

<ContentControl ContentTemplate="{StaticResource {Binding Template}}">
    <ContentPresenter />
</ContentControl>

所以模板实际上只是一个字符串,它将返回要使用的模板