This is a migrated thread and some comments may be shown as answers.

Unselect a selected appointment

6 Answers 223 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Craig Gamble
Top achievements
Rank 1
Craig Gamble asked on 23 Apr 2009, 08:37 AM
i have a little function that will loop through an active view and unselect any cells that have been selected

        private void UnselectCells()  
        {  
 
            SchedulerMonthViewElement monthView = this.schRates.SchedulerElement.ViewElement as SchedulerMonthViewElement;  
            Telerik.WinControls.RadElementCollection childrenCollection = monthView.Children[1].Children;  
 
            foreach (MonthCellElement cell in childrenCollection)  
            {  
                if (cell.Header.Selected == true)  
                {  
                    cell.Header.Selected = false;  
                }  
 
                if (childrenCollection.IndexOf(cell) == 34)  
                { break; }  
            }  
        } 

but i would like something similar to unselect any appointments but cant seem to find a way?? something like the following.......

        private void UnselectAppointments()  
        {  
            foreach (IEvent appointment in this.schRates.ActiveView.Appointments)  
            {  
                 
                if (appointment.Selected == true)  
                {  
                    appointment.Selected == false;  
                }  
            }  
        } 

Any help is greatly appreciated,

Cheers,
Craig

6 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 24 Apr 2009, 02:16 PM
Hi Craig Gamble,

Here is a method that will unselect all selected appointments in a month view:
private void UnselectAppointments(SchedulerMonthViewElement monthViewElement) 
        { 
            if (monthViewElement == null
            { 
                return
            } 
            MonthViewAreaElement monthViewAreaElement = monthViewElement.Children[1] as MonthViewAreaElement; 
            if (monthViewAreaElement == null
            { 
                return
            } 
 
            foreach (RadElement element in monthViewAreaElement.Children) 
            { 
                AppointmentElement appointmentElement = element as AppointmentElement; 
                if (appointmentElement != null
                { 
                    if (appointmentElement.Selected) 
                    { 
                        appointmentElement.Selected = false
                    } 
                } 
            } 
        } 


This method is used like bellow:
SchedulerMonthViewElement monthViewElement = this.radScheduler.SchedulerElement.ViewElement as SchedulerMonthViewElement; 
            this.UnselectAppointments(monthViewElement); 


However, I have to warn you that this method will break if the element structure is changed.
That is why we will think of an easier way to select / unselect appointments programmatically.


Regards,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Carlos
Top achievements
Rank 2
answered on 25 May 2010, 12:31 PM
What about in a DayView?
0
Dobry Zranchev
Telerik team
answered on 25 May 2010, 05:33 PM
Hello Carlos,

Thank for contacting us.

You could use the following code snippet to unselect all appointments in the DayView:
 
SchedulerDayViewElement dayViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement;
 
DayViewAppointmentsTable dayViewAppointmentsTable = dayViewElement.Children[2].Children[0].Children[2].Children[3].Children[1] as DayViewAppointmentsTable;
if (dayViewAppointmentsTable == null)
{
    return;
}
 
foreach (RadElement element in dayViewAppointmentsTable.Children)
{
    AppointmentElement appointmentElement = element as AppointmentElement;
    if (appointmentElement != null)
    {
        if (appointmentElement.Selected)
        {
            appointmentElement.Selected = false;
        }
    }
}

Do not hesitate to contact us for further questions.

All the best,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Carlos
Top achievements
Rank 2
answered on 27 May 2010, 02:48 PM
Thank you very much Dobry.
0
Pramod
Top achievements
Rank 1
answered on 28 Jun 2016, 10:32 AM
Hi Telerik Team,

I am using different view of Scheduler control, like DayView, WeekView/WorkWeekView and GroupedByResourceView etc...
What could be the best solutiuon to unselect the selected appointment?
Please help me to find best way.

Note : Am using the Telerik Version : 2014.2.617.0

Thanks
Pramod
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Jun 2016, 11:12 AM
Hello Pramod,

Thank you for writing. 

We introduced an improved RadScheduler in Q2 2014 (version 2014.2.617). Now, it provides SchedulerSelectionBehavior which performs selection operations and provides information about the current selection of cells and appointments in RadScheduler. You can use the public API for unselecting a specific appointment. Additional information is available here: http://docs.telerik.com/devtools/winforms/scheduler/fundamentals/scheduler-selection

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
Scheduler and Reminder
Asked by
Craig Gamble
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Carlos
Top achievements
Rank 2
Dobry Zranchev
Telerik team
Pramod
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or