如何在WPF中的ResourceDictionary中本地化字符串 [英] How to localize string in ResourceDictionary in WPF
本文介绍了如何在WPF中的ResourceDictionary中本地化字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用WPF中的应用程序。我想本地化应用程序中可用的所有字符串。目前我面临的问题是ResourceDictionary中可用的本地化字符串,下面是代码示例:
I am working on an Application in WPF. I want to localize all strings available in the application. Currently I am facing issue with localizing string available in ResourceDictionary below is code sample:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:resourceString="clr-namespace:FlowDocument.Properties">
<FlowDocumentScrollViewer x:Key="doctext" IsToolBarVisible="True" Zoom="80" ScrollViewer.VerticalScrollBarVisibility="Auto">
<FlowDocument>
<Paragraph>
<Run Text="Enter your Name"></Run>
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</ResourceDictionary>
这里我想从资源文件中读取输入您的姓名。如果有人回答如何做的话会非常有帮助。
感谢您的帮助。
Here I want to read "Enter your Name" from resource file. It will be really helpful if anyone reply the way How to do it.
Thanks for helping me.
推荐答案
常规WPF数据绑定 使用运行
元素的Text
属性。因此,您可以使用与WPF中其他任何位置相同的绑定。
Regular WPF data binding does work with theText
property of theRun
element. So you can use the same kind of binding that you would use anywhere else in the WPF.
这篇关于如何在WPF中的ResourceDictionary中本地化字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文