how can i use dropdownlist to dynamic select time period display on dayview?

4 posts, 0 answers
  1. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 10 Mar 2014 Link to this post



    Hi! sir:

    I have three different time period,like this:


    morning : 9:00~12:00

    afternoom:13:00~17:00

    night: 18:00~23:00

     
    May  i  use the dropdownlist  chose the the time   period that i want and dynamic change the RulerStartScale and
    dayView.RulerEndtScale  of dayview  (figure 1 show)    ? 

    Another problem  is that may i display ,15 minutes. 30minutes.  45 minutes. like figure 2
    show    ?
     
    thanks a lot!~~


                                customer number:QD1612651
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Mar 2014 Link to this post

    Hello Cooper,

    Thank you for writing.
    1. Yes, you can do that with the properties you mentioned. To make it easier, just reset them to their default values prior setting the new range:
    void radDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
    {
        SchedulerDayView dayView = radScheduler1.GetDayView();
     
        dayView.RulerStartScale = 0;
        dayView.RulerEndScale = 24;
        switch (e.Position)
        {
            case 0:
                dayView.RulerStartScale = 9;
                dayView.RulerEndScale = 12;
                break;
            case 1:
                dayView.RulerStartScale = 13;
                dayView.RulerEndScale = 17;
                break;
            case 2:
                dayView.RulerStartScale = 18;
                dayView.RulerEndScale = 23;
                break;
        }
    }


    2. You can set the range to be displayed in 15 minutes style, but the numbers (15,30,45) will not be displayed. to change the scale you can use the RangeFactor property:
    SchedulerDayView dayView = radScheduler1.GetDayView();
    dayView.RangeFactor = ScaleRange.QuarterHour;

    More information about this view is available here: http://www.telerik.com/help/winforms/scheduler-views-day-view.html.

    I hope this helps. 

    Regards,
    Stefan
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 20 Mar 2014 in reply to Stefan Link to this post

    Hi sir:

    I have another problem with  contextmenu of radscheduler, i want to know the item  which  i selected ,and get text to run my business logic,
    like figure1 show.

    thank you.......
  5. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 25 Mar 2014 Link to this post

    Hello Cooper,

    Thank you for getting back to me.

    In order to detect which item from the context menu is selected, please have a look at the following code snippet:
    public Form1()
    {
        InitializeComponent();
     
        this.radScheduler1.ContextMenuShowing += radScheduler1_ContextMenuShowing;
    }
     
    private void radScheduler1_ContextMenuShowing(object sender,
        SchedulerContextMenuShowingEventArgs e)
    {
        e.ContextMenu.PopupClosing -= ContextMenu_PopupClosing;
        e.ContextMenu.PopupClosing += ContextMenu_PopupClosing;
    }
     
    private void ContextMenu_PopupClosing(object sender, RadPopupClosingEventArgs args)
    {
        RadDropDownMenu menu = sender as RadDropDownMenu;
        RadItem item = menu.GetSelectedItem();
        if (item != null)
        {
            Console.WriteLine(item.Text);
        }
    }

    Please do not hesitate to contact us if you have any additional questions.
      
    Regards,
    Desislava
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
Back to Top