Jump to Slot and highlight in code behind

6 posts, 0 answers
  1. Pim Kerkhof
    Pim Kerkhof avatar
    18 posts
    Member since:
    Oct 2008

    Posted 24 Mar 2014 Link to this post

    Hello,

    I'im creating a search function and need a way to jump to a free timeslot and highlight it?
    Can you provide a solution?

    Regards,
    Pim
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 24 Mar 2014 Link to this post

    Hello Pim,

    There isn't a straight forward approach to achieve the desired scenario as the Slots don't contain any information whether they are empty or not. What you will need to do is to manually find the free space between the existing Appointments and then you will be easily able to highlight the desired slot using the SelectedSlot property of the ScheduleView. Once you have the Slot selected you can show it by using the ScrollIntoView method of the Schedule view:

    var slot = new Slot(DateTime.Today.AddHours(17), DateTime.Today.AddHours(18));
    this.scheduleView.SelectedSlot = slot;
    this.scheduleView.ScrollIntoView(slot);

    Hope this helps.

    Regards,
    Kalin
    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.

     
  3. DevCraft banner
  4. Pim Kerkhof
    Pim Kerkhof avatar
    18 posts
    Member since:
    Oct 2008

    Posted 24 Mar 2014 in reply to Kalin Link to this post

    Hello Kalin,

    ScrollIntoView does work as expected.
    SelectedSlot does not highlight the selectedslot however.
    It did work in a earlier version however.
    We currently use 2013.3.1204.

    Regards,
    Pim
  5. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 25 Mar 2014 Link to this post

    Hi Pim,

    I tested the same code snippet with the mentioned version (2013.3.1204) and everything work as expected. I'm attaching the video of the test as well as the sample project I have used. Please test it and let me know if you still have issues (if so let me know what I have missed here).

    I'm looking forward to hearing from you.

    Regards,
    Kalin
    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.

     
  6. Pim Kerkhof
    Pim Kerkhof avatar
    18 posts
    Member since:
    Oct 2008

    Posted 26 Mar 2014 in reply to Kalin Link to this post

    Hi Kalin,

    We are using Resources. Perhaps that's the reason wy highlighting isn't working?

    Kind regards,
    Pim
  7. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 27 Mar 2014 Link to this post

    Hi Pim,

    If you are using Resources you will need to add the Resources you need to select to the Resources collection of the Slot. For example the sample project can be modified the following way in order to have all the slots of all Resources selected:

    private void RadButton_Click(object sender, RoutedEventArgs e)
    {
        var resources = ((this.scheduleView.ResourceTypesSource as ResourceTypeCollection).First() as ResourceType).Resources;
        var slot = new Slot(DateTime.Today.AddHours(17), DateTime.Today.AddHours(18), resources);
        this.scheduleView.SelectedSlot = slot;
        this.scheduleView.ScrollIntoView(slot, true);
    }

    Hope this helps.

    Regards,
    Kalin
    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
DevCraft banner