MVVM Observable Collection with Calendar SelectedDates

7 posts, 0 answers
  1. Teresa
    Teresa avatar
    4 posts
    Member since:
    Aug 2012

    Posted 11 Oct 2010 Link to this post

    I would like to bind SelectedDates in the calendar to an ObservableCollection exposed via my View Model but I only see SelectedDate available as a two way binding and not SelectedDates.   I don't really want to two way bind to the observable collection but without this capability, the collection does not seem to be visible to bind to.  I can wire to the onchange event in code.  That may be the right way to do it but it feels wrong so I thought I would check.
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 14 Oct 2010 Link to this post

    Hello Teresa,

    It is not possible to bind the SelectedDates property as it is marked as a read only. Let us know if you need any further help.

    Regards,
    Kaloyan
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Michael
    Michael avatar
    4 posts
    Member since:
    Oct 2010

    Posted 16 Nov 2010 Link to this post

    You documentation on this property reads as follows:

    "The SelectedDates collection is an observable collection (although it is exposed as an IList) which contains the currently selected dates and can be used in binding."

    Note the last 5 words.
    You need to update that so I don't waste hours building a UI with the expectation that this will work.
  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 18 Nov 2010 Link to this post

    Hi Michael,

    Thank you for the comments. We will update the online help shortly. As a solution you can expose a custom attached property of Dates and set binding through it.

    Sincerely yours,
    Kaloyan
    the Telerik team
    See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
  6. saw
    saw avatar
    29 posts
    Member since:
    Jun 2014

    Posted 13 Jan 2015 in reply to Kaloyan Link to this post

    Any way to bind SelectedDates into ViewModel ObservableCollection<DateTime> ?
  7. Nasko
    Admin
    Nasko avatar
    585 posts

    Posted 13 Jan 2015 Link to this post

    Hello Shalin,

    With current version of RadCalendar it is not possible to bind the SelectedDates property to a Collection of DateTime objects because it is a read only property. We have already logged this feature request in our feedback portal and you can easily track its status on the following link:
    http://feedback.telerik.com/Project/143/Feedback/Details/87989-add-selecteddates-dependency-property

    However, as a workaround we could suggest you to check the following blog post that demonstrates how to create an additional property for the SelectedDates property and thus to achieve the desired:
    http://blogs.telerik.com/xamlteam/posts/11-06-13/using-the-multiple-selection-of-the-radcalendar-control-for-silverlight-and-wpf-with-mvvm.aspx

    We hope this will help you.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. saw
    saw avatar
    29 posts
    Member since:
    Jun 2014

    Posted 13 Jan 2015 in reply to Nasko Link to this post

    I just used "SelectionChanged" in radCalendar,
    ViewModel.SelectedDates = this.Calendars.SelectedDates;
Back to Top
DevCraft banner