Get highlighted time??

3 posts, 0 answers
  1. Mike Baldini
    Mike Baldini avatar
    11 posts
    Member since:
    Feb 2010

    Posted 23 Jun 2010 Link to this post

    Is there any way to get the currently highlighted time on the DayView of the RadScheduler?

    I have figured out how to get it based on a MouseClick (by handling the radScheduler_CellClick event), but I would like to be able to simply access it when needed rather than handling the mouseclick events.

            void radScheduler1_CellClick(object sender, Telerik.WinControls.UI.SchedulerCellEventArgs e) 
            { 
                if (radScheduler1.ActiveViewType == Telerik.WinControls.UI.SchedulerViewType.Day) 
                { 
                    int index = e.Cell.Parent.Children.IndexOf(e.Cell); 
                    Telerik.WinControls.UI.SchedulerDayView dv = radScheduler1.GetDayView(); 
                    DateTime dtDate = dv.StartDate; 
     
                    dtDate = dtDate.AddDays(index % dv.DayCount); 
                    index = index / dv.DayCount; 
                     
     
                    switch (dv.RangeFactor) 
                    { 
                        case Telerik.WinControls.UI.ScaleRange.FiveMinutes: 
                            index *= 5; 
                            break
                        case Telerik.WinControls.UI.ScaleRange.HalfHour: 
                            index *= 30; 
                            break
                        case Telerik.WinControls.UI.ScaleRange.Hour: 
                            index *= 60; 
                            break
                        case Telerik.WinControls.UI.ScaleRange.QuarterHour: 
                            index *= 15; 
                            break
                        case Telerik.WinControls.UI.ScaleRange.SixMinutes: 
                            index *= 6; 
                            break
                        case Telerik.WinControls.UI.ScaleRange.TenMinutes: 
                            index *= 10; 
                            break
                        default
                            break
                    } 
     
                    dtDate = dtDate.AddMinutes(index); 
                    this.Text = "Selected DateTime is " + dtDate.ToString(); 
                    //this.Text = "Selected time is " + TimeSpan.FromMinutes(index).Hours.ToString() + ":" + TimeSpan.FromMinutes(index).Minutes.ToString(); 
                } 
            } 

  2. Mike Baldini
    Mike Baldini avatar
    11 posts
    Member since:
    Feb 2010

    Posted 24 Jun 2010 Link to this post

    Alright... I guess I figured it out.

    DateTime[] dt = Telerik.WinControls.UI.SchedulerUIHelper.GetSelectedDates(this.RadScheduler1) 
    if (dt.Count == 0) return GetDefaultStartTime() else return dt[0] 

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 29 Jun 2010 Link to this post

    Hi Mike Baldini,

    Thank you for contacting us.

    I am happy that you found the solution - this is the correct method that you should use. Meanwhile you also could use the GetSelectedCells method of the SchedulerUIHelper class and get the date and time from the cell.

    If you have additional questions feel free to write us.

    Kind regards,
    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
Back to Top