使用 .resw 文件中的多个字符串资源到 ContentDialog

Using multiple string resources from .resw file into ContentDialog

我想使用 .resw 文件中的字符串设置 ContentDialog 的 PrimaryButtonText、SecondaryButtonText 和 Title 属性。不幸的是,我只能对使用 x:Uid 的一个属性执行此操作,因为无法接受在 ContentDialog 中设置两次 x:Uid。我什至尝试过这样做:

<ContentDialog>
<ContentDialog.PrimaryButtonText x:Uid="DialogConfirm" />
    <ContentDialog.SecondaryButtonText x:Uid="DialogCancel" />
</ContentDialog>

但是我遇到了一个例外

XBF generation error code 0x09c8

有什么办法可以做到吗?

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

<ContentDialog x:Uid="myDialog">
    <!--your dialog-->
</ContentDialog>

Resources.resw中设置:

myDialog.PrimaryButtonText ->  text for primary button
myDialog.SecondaryButtonText ->  text for secondary button

至于more guidelines and help, see MSDN.