答案 0 :(得分:2)
作为快速指南,您将从以下课程开始:
public class AlarmDay : INotifyPropertyChanged
{
public AlarmDay( string dayOfWeek )
{
DayOfWeek = dayOfWeek;
}
public DayOfWeek { get; }
private bool _isEnabled = false;
public bool IsEnabled
{
get => _isEnabled;
set
{
_isEnabled = value;
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
然后,您可以使用水平列表控件,将ItemsSource
设置为AlarmDay
类的7个适当实例。然后,DataTemplate
可以包含自定义控件,该控件包含Label
和带有角半径轮廓的Frame
。然后,您实施Tap
手势并更新数据绑定IsEnabled
实例(AlarmDay
)和BindingContext
Frame
的{{1}}属性。