我有一个具有以下用户控件的 XBAP 应用程序:
I have a XBAP application with the following user control:
<UserControl x:Class="XXX.UsersGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="Auto" Width="Auto">
<UserControl.Resources>
<DataTemplate x:Key="UpArrowUsers">
<DockPanel>
<TextBlock Text="xxUser" x:Name="upArrowUsersHeader" HorizontalAlignment="Center"></TextBlock>
<Path x:Name="arrow" StrokeThickness = "1" Fill= "gray" Data= "M 5,10 L 15,10 L 10,5 L 5,10"/>
</DockPanel>
</DataTemplate>
</UserControl>
...
现在我想从作为资源嵌入到应用程序中的 resx 文件中获取字符串xxUser"我如何做到这一点?
Now I want to fetch the string "xxUser" from a resx file which is embed as resource in the application How do I achieve this?
这些答案都不是你想要的.我将从阅读 WPF 中的本地化开始.您会发现,如果您使用 WPF 进行本地化,您需要在应用程序的每个节点上定义 x:Uid.
None of those answers are close to what you want. I'd start by reading about Localization in WPF. You'll find that if you are doing localization with WPF you'll want x:Uid defined on every node in your app.
http://msdn.microsoft.com/en-us/library/ms788718.aspx
这篇关于如何从资源中获取字符串以在 xaml 的 WPF 资源部分中分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!