the date of day view matches up with the selected date of weekview or monthview

7 posts, 0 answers
  1. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 19 Aug 2010 Link to this post

    On monthview or weekview, we select a date, eg  8/19/2010,  then we navigate to dayview and we want to see the same selected date 8/19/2010 on dayview.  How can we do this?

    It seems that the date shown on dayview is the first date of weekview or monthview when navigating to dayview from weekview or monthview
  2. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 19 Aug 2010 Link to this post

    we can use following code to do this  from weekview to dayview:

     

    private void radScheduler1_CellClick_1(object sender, SchedulerCellEventArgs e)

     

    {


     

    SchedulerCellElement ee = e.Cell;

     

    ddd = ee.Date;
    }

    ==============================================================

    try to use this code to do it but was not good because SchedulerCellElement   returned  by

     

    SchedulerUIHelper

     

    .GetCellAtPoint

     

     

     is null value

    here is code:

     

     

    private void radScheduler1_Click_1(object sender, EventArgs e)

     

    {

     

    Point p = new Point(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); ;

     

     

    SchedulerVisualElement viewe = radScheduler1.SchedulerElement.ViewElement;

     

     

    SchedulerCellElement ee = SchedulerUIHelper.GetCellAtPoint(p, viewe.Children)

    ====================================================
    what is the good way to do it?

     

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

    Posted 24 Aug 2010 Link to this post

    Hello Ming Zhao,

    Thank you for writing.

    The default behavior of RadScheduler when the view is changed from month to day is to show the start date of the month view. If you want to change this date, you can do it in the ActiveViewChanged event of RadScheduler. You should only set the property StartDate of the scheduler's ActiveView. You can take the selected date with the GetSelectedDates method of the SchedulerUIHelper class. I hope that this information will help you.

    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
  5. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 24 Aug 2010 Link to this post

    We did  try to implement as you suggest here, but  it aways returns zero selected dates. 

    Here are the codes:

     

     

    private void radScheduler1_ActiveViewChanged(object sender, SchedulerViewChangedEventArgs e)

     

    {

     

    DateTime[] selectDates = SchedulerUIHelper.GetSelectedDates(radScheduler1);

     

     

    if (selectDates.Length > 0)

     

    {

     

    DateTime selDt = selectDates[0];

     

    }

    }

    the selectDate.Length never larger than zero, no matter whether  a single  date is selected or mutiple dates are selected (see attached).


    Anything which we should adjust here in our codes?

  6. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 27 Aug 2010 Link to this post

    Hi Ming Zhao,

    Thank you for writing us back. When RadScheduler changes its ActiveView the SelectedDates collection is reset. You can handle the ActiveViewChanging event to view/store all selected dates and the ActiveViewChanged event when you want to restore them:

    private DateTime[] selectDates = null;
            private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
            {
                SchedulerUIHelper.SelectDates(radScheduler1, selectDates, true);
            }
     
            private void radScheduler1_ActiveViewChanging(object sender, SchedulerViewChangingEventArgs e)
            {
                selectDates = SchedulerUIHelper.GetSelectedDates(radScheduler1);
            }

    We will consider adding a property to control this behavior to be like Microsoft Outlook and keep the selection state when switching the view. 

    Should you have any further questions, do not hesitate to ask.

    Greetings, Julian Benkov
    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
  7. Ming Zhao
    Ming Zhao avatar
    44 posts
    Member since:
    Sep 2009

    Posted 27 Aug 2010 Link to this post

    your suggested codes here do not work for  RadControls_WinForms_2010_2_10_806_dev.


    when selectDates= null, SchedulerUIHelper.SelectDates call causes nullReference Exceeption

    private
    DateTime[] selectDates = null;
            private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
            {
                SchedulerUIHelper.SelectDates(radScheduler1, selectDates, true);
            }
     
            private void radScheduler1_ActiveViewChanging(object sender, SchedulerViewChangingEventArgs e)
            {
                selectDates = SchedulerUIHelper.GetSelectedDates(radScheduler1);
            }
  8. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 02 Sep 2010 Link to this post

    Hi Ming Zhao,

    You can use the following version of the ActiveViewChanged handler:

    private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
    {
        if(selectDates != null)
        {
            SchedulerUIHelper.SelectDates(radScheduler1, selectDates, true);
        }
    }

    I hope this helps.

    Regards,

    Julian Benkov
    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
UI for WinForms is Visual Studio 2017 Ready