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
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
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;
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
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.
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
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.
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
With your code snippet. Finally my problem is resolved now.
Thank you very much ^^