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

Binding SelectedAppointments

3 Answers 114 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
HDC
Top achievements
Rank 1
HDC asked on 28 Oct 2012, 10:34 AM
Hi,

I want to access the SelectedAppoints from the viewmodel, but it seems impossible to bind this property.

I can bind SelectedAppointment but why can i not bind SelectedAppointments?

Is there an other way to get this collection into the viewmodel? There is no events that i seem to be able to hook into when this collection changes either.

Best Regards,

Peter

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 01 Nov 2012, 08:43 AM
Hi Peter,

The SelectedItems property cannot be bound to the ViewModel's property, because it is a read-only dependency property and cannot be set. What I would suggest you is to set the ViewModel's property to the SelectedAppointments collection (the property of the ScheduleView is never changed) in the page's constructor like this:
InitializeComponent();
this.viewModel.ScheduleViewSelectedAppointments = this.scheduleView.SelectedAppointments;

Hope this helps.

All the best,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
HDC
Top achievements
Rank 1
answered on 02 Nov 2012, 10:18 AM
Hi Miroslav,

That helps me out somewhat, however it makes it difficult to base any kind of behavior on the collection. For example, if i would want to enable a button based on this collection changing or being set.

Anyways, i was able to program arround the limitation, but i still wonder why this collection is not exposed a little easier.

Best Regards,

Peter
0
Miroslav Nedyalkov
Telerik team
answered on 02 Nov 2012, 11:57 AM
Hello Peter,

One of the main reasons we decided to do so is that the default Silverlight and WPF controls are exposing their selection as a read-only property and we wanted to be consistent with these controls (like ListBox, DataGrid, TabControl, etc.).

Another important reason is that there are too many scenarios that should be handled if the property is settable and it lets both the user of the control and the developer of the control to do mistakes which we'd like to minimize.

Hope this makes sense to you.

All the best,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ScheduleView
Asked by
HDC
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
HDC
Top achievements
Rank 1
Share this question
or