Dynamically added DataTemplate - StaticResource for Converter can't be found

╄→尐↘猪︶ㄣ 提交于 2019-12-03 03:38:08

Just in case someone else takes a look at this question someday, it turns out, the code I presented at the top of this question actually works. The bug was that I had the following declaration elsewhere in my XAML:

<local:BlockToBrushConverter
    x:Key="_blockToBrushConverter" />

I believe this duplication prevented the resource from being declared locally for the dynamic DataTemplate (it couldn't create a resource with the same name twice within the same context).

One thing that is sort of unresolved for me is why some StaticResources need to be declared locally, while others (like the _gridViewCenterItemStyle StaticResource) can be declared higher in the tree (such as at the Window level) without a problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!