我有这个 C# 代码
public static class AS
{
public static bool ss; // Show Subcategory
}
public SettingsPage()
{
InitializeComponent();
}
void SsSwitch(object sender, ToggledEventArgs e)
{
App.DB.UpdateBoolSetting(Settings.Ss, e.Value);
//
// code here will update the value of AS.ss
// after the database has been updated
//
}
这个 XAML
<SwitchCell x:Name="SWCData" Text="Select Your Network"
On="{Binding AS.ss}" OnChanged="SsSwitch" />
我收到一条消息,指出视图没有属性或可绑定属性。
谁能帮我这个忙?
如果要绑定静态类,则参考以下代码进行绑定
<SwitchCell Text="Select Your Network"
On="{Binding Source={x:Static local:AS.ss}}" OnChanged="SsSwitch" />