Creating scheduleview runtime

3 posts, 1 answers
  1. Lasse
    Lasse avatar
    3 posts
    Member since:
    Oct 2012

    Posted 18 Oct 2012 Link to this post

    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:DayViewDefinition MinorTickLength="30min" MajorTickLength="1h"/>









    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);




    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
  2. Answer
    Yana avatar
    4547 posts

    Posted 23 Oct 2012 Link to this post

    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.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Lasse
    Lasse avatar
    3 posts
    Member since:
    Oct 2012

    Posted 24 Oct 2012 Link to this post

    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;
Back to Top