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

Creating scheduleview runtime

2 Answers 72 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Lasse
Top achievements
Rank 1
Lasse asked on 18 Oct 2012, 01:40 PM
Hi, I have just started with using your components and I am very impressed with them.
The scheduleview in particular matches and upcoming project well.

I have one question now.
I have added some in xaml and found this to be working for<Canvas x:Name="canvas" MouseDown="Canvas_MouseDown" MouseUp="Canvas_MouseUp" MouseMove="Canvas_MouseMove">
<
telerik:RadScheduleView HorizontalAlignment="Left" Margin="12,12,0,0" Name="radScheduleView1" VerticalAlignment="Top" Height="469" Width="208" MouseRightButtonDown="rect1_MouseLeftButtonDown" NavigationHeaderVisibility="Collapsed" MinAppointmentHeight="100" VerticalScrollBarVisibility="Hidden" MinTimeRulerExtent="2800" MaxTimeRulerExtent="2800">

<telerik:RadScheduleView.ViewDefinitions>

<telerik:DayViewDefinition MinorTickLength="30min" MajorTickLength="1h"/>

</telerik:RadScheduleView.ViewDefinitions>

<telerik:RadScheduleView.RenderTransform>

<TranslateTransform></TranslateTransform>

</telerik:RadScheduleView.RenderTransform>

<telerik:RadScheduleView.DragDropBehavior>

<local:ScheduleViewDragDropBehavior/>

</telerik:RadScheduleView.DragDropBehavior>

</telerik:RadScheduleView>
</Canvas>

Besides normal config and drag'n drop I have added MouseRightButtonDown and RenderTransform as I am moving it arround on a canvas.

Now I would like to be able to add more schedulers at runtime and load them up with the same config. But I am having problem doing so.
Using this code I can create one
this.x = new Telerik.Windows.Controls.RadScheduleView(); this.x.Height = 469;
this.x.Width = 533;
this.x.CurrentDate = DateTime.Today;
var appointments3 = new ObservableCollection<Appointment>();
this.x.AppointmentsSource = appointments3;
RadScheduleViewCommands.SetDayViewMode.Execute(null, this.x);

canvas.Children.Add(

 

this.x);


I am using RadScheduleViewCommands to set dayview, but it is not working. So what I am doing wrong here?

Any help will be appreciated.

Secondly the bonus question.
Ideally I would like to instantiate new schedulers based on xaml template, I tried following a few example I could find on other web resources but non of them really worked well for me. Main problem here was that I could not set the drag'n drop behavior. But of cause that could be done after creating if needed.
If you happen to have any examples of this that would also be appreciated.

Best regards
Lasse

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 23 Oct 2012, 03:07 PM
Hi Lasse,

Note that first you should add the DayViewDefinition to ViewDefinitions collection of RadScheduleView, please check this help article for more details.

Let us know whether this helps.

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Lasse
Top achievements
Rank 1
answered on 24 Oct 2012, 11:08 AM
Excellent, thank you. Works like a charm.

In case anyone else had issues with this particular case. Adding these two lines to the code behind fixed the rest of my issues.
this.x.RenderTransform = new TranslateTransform();
this.x.MouseRightButtonDown += rect1_MouseLeftButtonDown;
Tags
ScheduleView
Asked by
Lasse
Top achievements
Rank 1
Answers by
Yana
Telerik team
Lasse
Top achievements
Rank 1
Share this question
or