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

Changing horizontal scroll range on Timeline View

8 Answers 162 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Peerapong
Top achievements
Rank 1
Peerapong asked on 17 Aug 2015, 10:57 AM

My problem is occured at RadScheduler control on Timeline View mode about scrolling.

Follow my attach image, when I click at number 1 view'll change 1 scale (Ex. 1 hour).

If I click at number 2 I'll got same result with number 1.

My question is how I change scroll range at number 2 (Ex. view move forward to 4 hour per click)

 

Thank you.

8 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 18 Aug 2015, 10:48 AM
Hi Peerapong,

Thank you for writing.

In order to achieve this task, you would need to access the NavigationElement object of your SchedulerTimelineViewElement and modify the value of the LargeChange property. Please check my code snippet below: 
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
         
        this.Load += Form1_Load;
    }
 
    private void Form1_Load(object sender, EventArgs e)
    {
        this.radScheduler1.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Timeline;
        SchedulerTimelineView schedulerTimelineView = this.radScheduler1.GetTimelineView();
        schedulerTimelineView.ShowTimescale(Timescales.Hours);
 
        SchedulerTimelineViewElement viewElement = (SchedulerTimelineViewElement)this.radScheduler1.ViewElement;
        viewElement.NavigationElement.SmallChange = 4;
        viewElement.NavigationElement.LargeChange = 4;
        viewElement.NavigationElement.RadPropertyChanging += NavigationElement_RadPropertyChanging;
    }
 
    private void NavigationElement_RadPropertyChanging(object sender, Telerik.WinControls.RadPropertyChangingEventArgs args)
    {
        if (args.Property.Name == "SmallChange" || args.Property.Name == "LargeChange")
        {
            if ((int)args.NewValue < (int)args.OldValue)
            {
                args.Cancel = true;
            }
        }
    }
}

Additional information on working with the timeline view, you can find in the following documentation article: Timeline View.

I am also sending you a gif file showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Peerapong
Top achievements
Rank 1
answered on 19 Aug 2015, 05:04 AM

Thank you very much. but my scheduler add resources too

I'm try to comment resource code adding, I found your code is working well

What I should do about resource adding?

Example code is here.

 

//  Add resource to collection.
int iColIdx = 0;
SchedulerResourceCollection srcInst = new SchedulerResourceCollection();
radSchdView.Resources.BeginUpdate();
for(int iIdx=0; iIdx < 20; iIdx++){
    Resource    resource    = new Resource("1234", "3333");
    resource.Color          = G.BG_COL[iColIdx];
    srcInst.Add(resource);
    iColIdx++;
    if(iColIdx > (G.BG_COL.Length - 1)) iColIdx = 0;
}
//  Set resources to scheduler.
SchedulerBindingDataSource  sbd = new SchedulerBindingDataSource();
ResourceMappingInfo         rmi = new ResourceMappingInfo();
rmi.Id      = "Id";
rmi.Name        = "Name";
rmi.Color       = "Color";
rmi.Visible     = "Visible";
sbd.ResourceProvider.Mapping    = rmi;
sbd.ResourceProvider.DataSource = srcInst;
radSchdView.DataSource          = sbd;
radSchdView.Resources.EndUpdate();
radSchdView.GroupType   = GroupType.Resource;
 
schTlve.Header.LayoutUpdated    += new EventHandler(UpdateSchedulerHeader);
schTlve.NavigationElement.SmallChange = 5;
schTlve.NavigationElement.LargeChange = 10;
schTlve.NavigationElement.RadPropertyChanging   += NavigationElement_RadPropertyChanging;

0
Hristo
Telerik team
answered on 21 Aug 2015, 02:18 PM
Hi Peerapong,

Thank you for writing back.

If I understand correctly, you would like to add resources to your RadScheduler. Please refer to the following documentation article, providing detailed information and examples: Working with Resources.

I hope this information is useful. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Peerapong
Top achievements
Rank 1
answered on 22 Aug 2015, 03:44 PM

Oh sorry, Really I mean...

after I add resource to scheduler after form load event, I found that RadPropertyChanging event doesn't work

(RadPropertyChanging is not fire)

so I still have a problem.

 

Thank you for your reply.

0
Hristo
Telerik team
answered on 26 Aug 2015, 01:19 PM
Hi Peerapong,

Thank you for writing back.

I am not able to observe issues with the horizontal scrolling of RadScheduler ‚Äčeven after I am adding resources at run time.

Please find attached my sample project as well as a gif file showing the result on my end. If you are still experiencing issues please get back to me with additional information of your current set up.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Peerapong
Top achievements
Rank 1
answered on 31 Aug 2015, 03:52 AM

Oh sorry, I misunderstand about resource may be I mean is grouping by resource

follow attachment picture is a part which I added then event not fired properly.

0
Hristo
Telerik team
answered on 31 Aug 2015, 02:24 PM
Hello Peerapong,

Thank you for writing back.

When RadScheduler is grouped by resources it does not expose its horizontal scroll bar. If you would still like to modify its SmallChange and LargeChange properties, you would need to use reflection. Please see my code snippet below: 
TimelineGroupingByResourcesElement viewElement = (TimelineGroupingByResourcesElement)this.radScheduler1.ViewElement;
FieldInfo fi = ((TimelineScrollNavigationElement)viewElement.Children.Last().Children[2]).GetType().GetField("hScrollBar", BindingFlags.NonPublic | BindingFlags.Instance);
RadScrollBarElement scrollbar = fi.GetValue(((TimelineScrollNavigationElement)viewElement.Children.Last().Children[2])) as RadScrollBarElement;
if (scrollbar != null)
{
    scrollbar.LargeChange = 4;
    scrollbar.SmallChange = 4;   
}

I am also sending you a gif file showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Peerapong
Top achievements
Rank 1
answered on 01 Sep 2015, 02:21 AM

With your code snippet. Finally my problem is resolved now.

Thank you very much ^^

Tags
Scheduler and Reminder
Asked by
Peerapong
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Peerapong
Top achievements
Rank 1
Share this question
or