在Xamarin.Forms

时间:2018-08-22 19:29:30

标签: c# xamarin.forms binding uiswitch

我正在使用Switch来切换一些值。

<Switch x:Name="masterSwitch"  Grid.Row="1" Grid.Column="0" IsToggled="{Binding Value}"/>

值是表中记录的参数:

public class MasterSwitch
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }
    public DateTime Date { get; set; }
    public bool Value { get; set; }
}

但是如何指定要查找的表呢? 我希望将开关绑定到MasterSwitch表(我已经为其建模的表)上。

我是否将BindingContext设置为xaml?

0 个答案:

没有答案