从 Resources.Language.Resx 获取值并填充字段 WPF 后面的代码

发布于 2024-12-24 20:32:37 字数 534 浏览 2 评论 0原文

我在 WPF 应用程序中有以下代码

<TextBlock HorizontalAlignment="Center"  id="txtInternet" Foreground="Teal" FontFamily="Gill Sans MT" Text="{Loc Navigation_Panel_Title_Internet}" FontSize="30"  Height="45" Width="103" Background="White" />

,它很棒,但我想要做的是在后面的代码中设置文本的值。 ?

 txtInternet.Text = {Loc Navigation_Panel_Title_Internet}

有人知道该怎么做吗?

我使用 http://wpflocalization.codeplex.com/ 更改语言

I have the following code

<TextBlock HorizontalAlignment="Center"  id="txtInternet" Foreground="Teal" FontFamily="Gill Sans MT" Text="{Loc Navigation_Panel_Title_Internet}" FontSize="30"  Height="45" Width="103" Background="White" />

In a WPF App, its great, but what I want to do is set the value for the text in the code behind. ?

Ie

 txtInternet.Text = {Loc Navigation_Panel_Title_Internet}

Anyone know how to do it ?

Im using http://wpflocalization.codeplex.com/ to change the languages

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧伤还要旧人安 2024-12-31 20:32:37

请尝试此处提到的方法

public string GetUIString(string key)
{
      string uiString;
      LocTextExtension locExtension = new LocTextExtension(key);
      locExtension.ResolveLocalizedValue(out uiString);
      return uiString;
}

Try this method as mentioned here

public string GetUIString(string key)
{
      string uiString;
      LocTextExtension locExtension = new LocTextExtension(key);
      locExtension.ResolveLocalizedValue(out uiString);
      return uiString;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文