ReadOnly Appointment and Code behind...

3 posts, 0 answers
  1. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 02 Jul 2014 Link to this post


    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

    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. Rosen Vladimirov
    Rosen Vladimirov avatar
    640 posts

    Posted 04 Jul 2014 Link to this post

    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.

    Rosen Vladimirov
    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.
  3. ManniAT
    ManniAT avatar
    885 posts
    Member since:
    Nov 2003

    Posted 04 Jul 2014 Link to this post

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