将 .resw 文件中的多个字符串资源用于 ContentDialog

Sta*_*tam 0 xaml dialog winrt-xaml uwp

我想使用我的 .resw 文件中的字符串设置 ContentDialog 的 PrimaryButtonText、SecondaryButtonText 和 Title 属性。很遗憾 ?只能对使用 x:Uid 的一个属性执行此操作,因为不能接受在 ContentDialog 内设置 x:Uid 两次。我什至试图做这样的事情:

<ContentDialog>
<ContentDialog.PrimaryButtonText x:Uid="DialogConfirm" />
    <ContentDialog.SecondaryButtonText x:Uid="DialogCancel" />
</ContentDialog>
Run Code Online (Sandbox Code Playgroud)

但我有一个例外

XBF 生成错误代码 0x09c8

有什么办法可以做到这一点吗?

Rom*_*asz 5

仅为ContentDialog设置x:Uid然后在资源文件中设置适当的属性(看看 MSDN):

<ContentDialog x:Uid="myDialog">
    <!--your dialog-->
</ContentDialog>
Run Code Online (Sandbox Code Playgroud)

Resources.resw设置中:

myDialog.PrimaryButtonText ->  text for primary button
myDialog.SecondaryButtonText ->  text for secondary button
Run Code Online (Sandbox Code Playgroud)

有关更多指南和帮助,请参阅 MSDN