You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 15, 2024. It is now read-only.
James Montemagno edited this page Oct 2, 2018
·
4 revisions
Here are some common questions about the Preferences API:
Is it possible to leverage data binding with preference?
When you developing with Xamarin.Forms you may want to use data binding with a preference. For example you may have a switch that is bound to a boolean:
In your ViewModel you could write a property that uses the Preferences API to get, set, and raise a property notification:
conststringActiveKey="is_active_key";publicboolIsActive{
get =>Preferences.Get(ActiveKey,false);set{if(IsActive==value)return;Preferences.Set(ActiveKey,value);OnPropertyChanged(nameof(IsActive));}}