[英]Can i store string in <Application.Resources> and bind to it?
我在幾個頁面上使用微軟的AdControl ......但是為了簡化它我想將ApplicationId存儲一次並將其作為資源讀取。
是否可以在App.xaml中使用然后在控件中設置綁定到它? 但是怎么樣?
使用"{StaticResource name}"
就像使用<Page.Resources>
要存儲資源,創建一個新的<ResourceDictionary>
在<ResourceDictionary.MergedDictionaries>
把你的資源在。
例如:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary>
<x:String x:Key="Foo">Bar</x:String>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.