加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何从资源中获取字符串以在xaml中的WPF资源部分中分配

发布时间:2020-12-15 03:58:38 所属栏目:百科 来源:网络整理
导读:我有一个XBAP应用程序与以下用户控制: 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.Resour
我有一个XBAP应用程序与以下用户控制:
<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”
我该如何实现?

解决方法

没有一个答案是接近你想要的.我将首先阅读WPF中的本地化.你会发现,如果你正在使用WPF进行本地化,你将需要在应用程序的每个节点上定义x:Uid.

http://msdn.microsoft.com/en-us/library/ms788718.aspx

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读