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

ContextMenu IsChecked binding to Appointment Property

4 Answers 279 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 03 Feb 2017, 06:23 PM

I am trying to bind a few ContextMenu items to the selected appointment's properties, however I can't seem to get to the DataContext of the scheduleview.

<telerik:RadMenuItem Header="Requires Nurse..." IsChecked="{Binding Menu.UIElement.SelectedAppointment.Require_Nurse}" />

I've tried RelativeSource up to the ScheduleGrid, or direct to UIElement and everything gives me the same binding expression error that Schedule_VM doesn't contain a property for Require_Nurse.

Is there any way to bind a context menu item to the appointment?  Even if I get it bound will it actually allow modifying of the property?

4 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 07 Feb 2017, 08:46 AM
Hello Brandon,

How the custom Appointment is implemented? Can you provide a sample project demonstrating the exact implementation? You could also check the following demo from our Silverlight examples that demonstrate a sample implementation of RadScheduleView with ContextMenu:
http://demos.telerik.com/silverlight/#ScheduleView/ContextMenu

I'm looking forward to hearing from you.

Regards,
Kalin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Brandon
Top achievements
Rank 1
answered on 09 Feb 2017, 09:18 PM

The custom appointment is just a straight modification of the SqlAppointment model, although it could also be illustrated with attempting to bind to the IsAllDayEvent property in the standard appointment class. 

 

I've attached a modified demo of the WithDatabase class where I attempt to add the context menu with the IsAllDayEvent property bound to the IsChecked of the menuitem.  There is one all day event shown on the left when run.  When this is right clicked it should show checked.

https://app.box.com/s/07y1l4gpl2h3dzrkn0vkz35988sdm7kf

PS. It would really be nice if we could upload zip files in this forum.

0
Kalin
Telerik team
answered on 13 Feb 2017, 11:58 AM
Hi Brandon,

The binding to the Menu property actually looks for such a property in the DataContext of ScheduleView. The Menu property is property of the RadMenuItem, so if you change the binding the following way everything will work as expected:

<telerik:RadMenuItem Header="Is All Day Appointment" IsChecked="{Binding Path=Menu.UIElement.SelectedAppointment.IsAllDayEvent, RelativeSource={RelativeSource Self}}" />

Hope this will help you to achieve the desired.

Regards,
Kalin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Brandon
Top achievements
Rank 1
answered on 20 Feb 2017, 08:37 PM
Thank you, this worked well.  :)
Tags
ScheduleView
Asked by
Brandon
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Brandon
Top achievements
Rank 1
Share this question
or