|
<SfDropDownList TValue="string" Placeholder="Select"
TItem="string"
DataSource="@LocalData">
<DropDownListFieldSettings Text="Text" Value="Text"></DropDownListFieldSettings>
<DropDownListEvents TValue="string" TItem="string" ValueChange="onValueChange">
</DropDownListEvents>
</SfDropDownList>
<SfSchedule TValue="AppointmentData" Height="550px" AllowDragAndDrop="false" @bind-SelectedDate="@CurrentDate">
<ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
</SfSchedule>
@code{
DateTime CurrentDate = new DateTime(2020, 1, 31);
private string[] LocalData = new string[] { "Meeting", "Test", "Conference", "Vacation" };
private void onValueChange(ChangeEventArgs<string, string> args)
{
DataSource = GetScheduleData().Where(x => x.Subject == args.Value).ToList();
}
List<AppointmentData> DataSource = GetScheduleData();
static List<AppointmentData> GetScheduleData()
{
List<AppointmentData> dataSource = new List<AppointmentData>
{
new AppointmentData{ Id = 1, Subject = "Meeting", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
new AppointmentData{ Id = 2, Subject = "Test", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
new AppointmentData{ Id = 3, Subject = "Conference", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
new AppointmentData{ Id = 4, Subject = "Vacation", StartTime = new DateTime(2020, 1, 31, 9, 30, 0) , EndTime = new DateTime(2020, 1, 31, 11, 0, 0)},
};
return dataSource;
} |