Samantha J T Star
Samantha J T Star

Reputation: 32828

Binding static class property failing in <SwitchCell>

I have this C# code

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
   //
}

this XAML

<SwitchCell x:Name="SWCData" Text="Select Your Network" 
     On="{Binding AS.ss}" OnChanged="SsSwitch" />

I am getting a message saying that no property or bindable property for the view.

Can anyone give me help on this?

Upvotes: 0

Views: 62

Answers (1)

VenkyDhana
VenkyDhana

Reputation: 905

If you are binding static class then refer the below code to bind

<SwitchCell  Text="Select Your Network" 
                           On="{Binding Source={x:Static local:AS.ss}}" OnChanged="SsSwitch" />

Upvotes: 1

Related Questions