Динамично добавленный DataTemplate - StaticResource для Преобразователя не может быть найден

Ваш ответ корректен. is оператор сравнивает идентификационные данные двух объектов. == оператор сравнивает значения двух объектов.

идентификационные данные объекта никогда не изменяются, как только они были созданы; можно думать о нем как об адресе объекта в памяти.

можно управлять поведением сравнения объектных значений путем определения __cmp__ метод или богатое сравнение метод как __eq__.

10
задан devuxer 21 November 2014 в 20:11
поделиться

1 ответ

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.

6
ответ дан 4 December 2019 в 03:16
поделиться
Другие вопросы по тегам:

Похожие вопросы: