来自XAML样式的resx资源的引用字符串

时间:2016-07-07 23:19:13

标签: winrt-xaml windows-10 windows-10-universal uwp-xaml

我的Win10 UAP中有按钮样式。风格有工具提示。

如何在resx字符串资源中创建此样式引用文本?

<Style x:Key="MyButtonStyle" TargetType="Button" >
        ...
        <Setter Property="ToolTipService.ToolTip" Value="<string in resx resources>" />

    </Style>

1 个答案:

答案 0 :(得分:1)

你好在UWP中最好使用.resw而不是.resx。以下是使用.resw资源的方法:

<Style x:Key="CustomButtonStyle" TargetType="Button">
    <Setter Property="ToolTipService.ToolTip">
        <Setter.Value>
            <TextBlock x:Uid="CustomText" />
        </Setter.Value>
    </Setter>
</Style>

我的.resw文件如下所示: 名称 - &gt; CustomText.Text

价值 - &gt;这是自定义文字