我有UserControl,它需要执行一些多语言功能.在构造函数中,我使用ResourceDictionary动态加载合适的XAML。在这个XAML中,我有:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="somekey">Some Label</system:String></ResourceDictionary>我就有了
Header = {DynamicResource somekey}在DataGridTextColumn中的DataTemplate中,这个UserControl也使用它。看起来DataTemplate不知道新的ResourceDictionary。
但是,这是行不通的。拜托,为什么?
发布于 2011-07-11 17:36:23
我想您应该将(Re)源绑定到标头内容。资源本身不能通知任何更改,因此绑定可能是解决方案。
Header={Binding Source={DynamicResource someKey}, Path=.}无论如何,我不确定:永远不要尝试这样的条件。
https://stackoverflow.com/questions/6653270
复制相似问题