2012-11-11 88 views

回答

2

要做到這一點,您需要x:Static標記擴展名,不幸的是is unavailable on Windows Phone

所以,只要指定一個視圖模型到您的網頁,並在屬性暴露值:

public string MyValue 
{ 
    get 
    { 
     return Windows.Storage.ApplicationData.Current.LocalSettings.Values["MyValue"]; 
    } 
} 

或者你也可以暴露整個詞典:

public Windows.Storage.ApplicationDataContainer Settings 
{ 
    get 
    { 
     return Windows.Storage.ApplicationData.Current.LocalSettings; 
    } 
} 

然後將其綁定在XAML :

<TextBlock Text="{Binding Path=Settings[MyValue]}" /> 
+0

優秀。謝謝! – l33t

相關問題