【问题标题】:WPF Using Resource Variables in xamlWPF 在 xaml 中使用资源变量
【发布时间】:2009-04-07 15:59:37
【问题描述】:

我的 App.xaml 中有一个全局字符串,我想在 UserControl xaml 中使用如何引用它?

<Application.Resources>
   <sys:String x:Key="Assembly">Zpg</sys:String>
</Application.Resources>

我在 UserControl 资源中也有一个变量,我是否可以在 xaml 中以类似的方式使用它?

<UserControl.Resources>
    <sys:String x:Key="Dictionary">Test</sys:String>
</UserControl.Resources>

我希望这是有道理的,基本上我有以下我想参考上面的变量来替换,因为我会经常使用它们。

Text="{LocText Key=MyString, Dict=Test, Assembly=Zpg}"

谢谢,

詹姆斯

【问题讨论】:

标签: wpf resources


【解决方案1】:
Text="{LocText Key=MyString, Dict={StaticResource Dictionary}, Assembly={StaticResource Assembly}}"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多