We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Search Event in SfScheduler

Hi,

Is there a way to search for an event in SfScheduler which is then also displayed?

Thank you in advance for your efforts.


8 Replies 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team October 17, 2022 02:21 PM UTC

Hi Jurgen,


We would like to inform you that we need more details to check the reported scenario from our side. Please share the following details which will help us to check on it and provide you with the solution as soon as possible.


  • Share the exact details to achieve. 

  • Share the ouput image to achieve. 


Regards,

SaiGanesh Sakthivel



JT Jürgen Teufel October 17, 2022 03:27 PM UTC

Hello,


it's about the calendar same as in the demo (.net core):




The question here is whether it is possible for the user to search for calendar entries and then have the data displayed. True to the MVVM modeling, the calendar is bound to an ObservableCollection in which all the data is located.







SS SaiGanesh Sakthivel Syncfusion Team October 18, 2022 01:28 PM UTC

Hi Jurgen,


Your requirement can be achieved with the help of LoadOnDemand Command in SfScheduler. Inside the LoadOnDemand command, you can filter the appointments with the help of visible dates of the view and set the collection to display in the view. Please refer to the code snippet for your reference.


Code snippet

public async void ExecuteOnDemandLoading(object parameter)

        {

            if (parameter == null)

            {

                return;

            }

 

            this.ShowBusyIndicator = true;

            await Task.Delay(500);

            await Application.Current.MainWindow.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =>

            {

                this.Events = this.GenerateSchedulerAppointments((parameter as QueryAppointmentsEventArgs).VisibleDateRange);

            }));

            this.ShowBusyIndicator = false;

        }

 

        /// <summary>

        /// Method to generate scheduler appointments based on current visible date range.

        /// </summary>

        /// <param name="dateRange">Current visible date range.</param>

        private IEnumerable GenerateSchedulerAppointments(DateRange dateRange)

        {

 

            var appointments = new ObservableCollection<SchedulerModel>();

 

            foreach (SchedulerModel app in ActualEvents)

            {

                if ((app.From.Date >= dateRange.ActualStartDate.Date && app.From.Date <= dateRange.ActualEndDate.Date) ||

                (app.To.Date >= dateRange.ActualStartDate.Date && app.To.Date <= dateRange.ActualEndDate.Date))

                    appointments.Add(app);

            }

 

            return appointments;

        }


Please refer to the tested sample in the following locations.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SchedulerWPF1802576326


Please let us know if you have any concerns.


Regards,
SaiGanesh Sakthivel



JT Jürgen Teufel October 18, 2022 02:28 PM UTC

Hi,

thank you for this Information, but where ist there a search Function such as in the Outlook calendar?

When you enter a search term, the calendar is already loaded. I imagine a text box in which you can enter a search text and then the calendar will display the corresponding entry with its day.

Regards Juergen



SS SaiGanesh Sakthivel Syncfusion Team October 19, 2022 12:11 PM UTC

Hi Jurgen,


Your requirement can be achieved at the sample level. We suggest you filter the search text in the scheduler itemsource and bind the filter items in the listview to display in the view. Please refer to the following code snippet for your reference.


Code snippet

private void text_TextChanged(object sender, TextChangedEventArgs e)

{

    if ((sender as TextBox).Text == "")

    {

        listview.Visibility = Visibility.Collapsed;

        scheduler.Visibility = Visibility.Visible;

    }

    else

    {

        listview.Visibility = Visibility.Visible;

        scheduler.Visibility = Visibility.Collapsed;

        var data = new ObservableCollection<SchedulerModel>();

        foreach (SchedulerModel item in scheduler.ItemsSource)

        {

            if (item.EventName.ToLower().Contains((sender as TextBox).Text.ToLower()))

                data.Add(item);

        }

 

        listview.ItemsSource = data;

    }

}


Please refer to the demo sample in the following locations.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SchedulerWPF-1811926456


Please let us know if you have any concerns.


Regards,
SaiGanesh Sakthivel



JT Jürgen Teufel October 19, 2022 04:28 PM UTC

Hi SaiGenesh,

it is a simple and good Solution.

How can I get back to the corresponding calendar entry in the calendar view by double-clicking, for example?

The target is that I can then use code to display the calendar in such a way that the selected entry has a focus.

Regards Juergen




SS SaiGanesh Sakthivel Syncfusion Team October 20, 2022 11:50 AM UTC

Hi Jurgen,


#Regarding DoubleTap to return the scheduler control

Your requirement can be achieved with the help of MouseDoubleClick event in the Listview. Inside the event, you can navigate to the double tapped item in the scheduler view. Please refer to the following code snippet for your reference.


Code snippet

private void listview_MouseDoubleClick(object sender, MouseButtonEventArgs e)

{

    if (e.Source != null)

    {

        listview.Visibility = Visibility.Collapsed;

        scheduler.Visibility = Visibility.Visible;

        var selectedItem = (e.Source as ListView).SelectedItem as SchedulerModel;

        scheduler.NavigateTo(selectedItem.From);

    }

}


Please refer to the demo sample in the following locations.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SchedulerWPF-750504194


Please let us know if you have any concerns.


Regards,
SaiGanesh Sakhtivel


Marked as answer

JT Jürgen Teufel October 20, 2022 03:06 PM UTC

Hi  SaiGanesh,


thanks for this perfekt work :-)


Regards,

Jürgen



Loader.
Live Chat Icon For mobile
Up arrow icon