Manipulate multiple appointments in MVVM pattern

2 posts, 0 answers
  1. Isto
    Isto  avatar
    1 posts
    Member since:
    Jan 2014

    Posted 06 Mar 2015 Link to this post


    I am creating a wpf application with MVVM pattern. The application has a radscheduleview component with context menu attached to it. When user select the "Delete Note" menu item, how can I get all selected appointments into the list which I can then go through, and do desired manipulations to each appointment?

    Currently I have a command which delete one appointment at a time. A new requirement is deletion of all selected appointments. Any ideas?

            public RelayCommand<CustomAppointment> DeleteNoteCommand
                    return deleteNoteCommand
                        ?? (deleteNoteCommand = new RelayCommand<CustomAppointment>(
                                              p =>
                                                  if (p != null)
                                                      var message = new DialogMessage("Delete Note?", DeleteNoteCallback)
                                                          Button = MessageBoxButton.OKCancel,
                                                          Caption = "Delete Note",
                                                          Icon = MessageBoxImage.Warning
                                                      deletedNote = p; // global variable to send selected item to messenger
                                              p => (p != null) && (p.Source == NOTE));
  2. Nasko
    Nasko avatar
    559 posts

    Posted 10 Mar 2015 Link to this post

    Hi Isto,

    In order to achieve the desired behavior of RadMenuItem's Command and get all SelectedAppointments of RadScheduleView you could pass them as a CommandParamenter as shown below - thus you will be able to manipulate with these Appointments  as needed when the command is executed:

    <telerik:RadMenuItem Header="Delete Note" Command="{Binding Source={StaticResource MyViewModel}, Path=DeleteAllSelectedAppointmentsCommand, Mode=TwoWay}"
                            CommandParameter="{Binding Path=Menu.UIElement.SelectedAppointments,RelativeSource={RelativeSource Self}}"/>

    Hopes this helps.


    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.

  3. DevCraft banner
Back to Top