Is it possible to dynamically create a ResourceKey for a StaticResource? (eg using a Binding)

后端 未结 2 1517
有刺的猬
有刺的猬 2021-01-15 03:33

Suppose the object I\'m binding to has a property with a string representing the ResourceKey - how do I get a StaticResource to dynamically acquire it\'s ResourceKey based o

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-15 04:30

    I found exactly what I was looking for here:

    http://blog.functionalfun.net/2009/12/specifying-resource-keys-using-data_31.html

    It's a custom markup extension that behaves like a regular binding but the Path will point to a property that transforms the target into a ResourceKey and the binding will then return the resource!

    I've found this extremely useful!

提交回复
热议问题