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

ReadOnly Appointment and Code behind...

2 Answers 64 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
ManniAT
Top achievements
Rank 2
ManniAT asked on 02 Jul 2014, 01:41 PM
Hi,

since I work with MVVM I want to avoid code-behind as much as possible.
I need "read only appointments" and found this in help http://www.telerik.com/help/wpf/radscheduleview-features-speacialslots.html

Although I love your controls I really miss good MVVM support.
For an example RadGridView (which I use a lot due to its performance and capabilities) is not useable with "pure MVVM" due to the lack of Command support.
Almost everything is handled via events (like RowEditEnding, RowValidating)...

But there are at least "simple behaviors" like "CanUserEdit" or so which need no code behind.

How about RadScheduleView? Is there a way to avoid code behind (except subclassing the control)?

My need - some appointments have to be ReadOnly - either in general or for certain users (owner may edit / reader must not).
I can provide a property at the appointment (IsReadOnly or so) - so all I need is to handle this with RadScheduleView...

2 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 04 Jul 2014, 10:10 AM
Hi ManniAT,

In our controls you will find EventToCommandBehavior that can be used to pass any event to your ViewModel. More information about EventToCommandBehavior can be found here.

In order to use ReadOnly appointments, you can add IsReadOnly property to your Appointment and use custom DragDropBehavior in which you can prevent Drag operation if the appointment is read-only. Also you can pass ShowDialog event of RadScheduleView to your ViewModel and check if the appointment parameter in the event arguments is read-only appointment. In this case you can cancel dialog's opening.

I've prepared a sample project to illustrate all of the above. Please give it a try and inform us in case you have any problems or concerns.

Regards,
Rosen Vladimirov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
ManniAT
Top achievements
Rank 2
answered on 04 Jul 2014, 10:48 AM
Hi Rosen,

works like a charm.
I just replaced the "CustomAppointment" in the CustomDragDropBehavior with a "IAmReadOnly" interface (to be more flexible) and that solves my needs.

I know about your EventToCommandbehavior and you are right - it works in this case.
I just "forgot" about this thing (or the one from MVVM Light or InvokeCommandAction Blend Interaction).

The reason why I don't use it normally is that this approach doesn't support "CanExecute" (and it blows up the XAML).

Anyhow - in this case it fits my needs.

Thank you for your excellent support
Manfred
Tags
ScheduleView
Asked by
ManniAT
Top achievements
Rank 2
Answers by
Rosen Vladimirov
Telerik team
ManniAT
Top achievements
Rank 2
Share this question
or