Hi, I'm trying to set a tooltip on an Appointment in the XamScheduleView. I have learned that, in order to achieve this, I should define a Style for the ActivityToolTipPresenter, and set the Template property. In this template, I want to bind to some properties of the business object which is the data source for the appointment. I tried to create Appointment object like this:
Appointment appointment = new Appointment() { Id = id.ToString(), ... (more properties) ... , DataItem = businessObject };
Then, in the Style I tried to access the business object like this:
<Grid DataContext="{Binding Activity.DataItem.SomeProperty}" />
However, this binding doesn't work. Apparently, the DataItem no longer refers to my BusinessObject, but to itself instead (the Appointment object).
So, how can I achieve the desired effect?
Regards, Stefan
Hello Stefan,
I have attached a sample application that writes a Style for AppointmentPresenter to set a custom tooltip on an appointment. This application takes the ControlTemplate with the key “ActivityTemplate” from the generic.shared.xaml default style of the XamSchedule. A common directory for finding this default style is: C:\Program Files (x86)\Infragistics\2014.1\WPF\DefaultStyles\Schedule.
In this ControlTemplate, under the first grid and VisualStateGroup, there is another grid that I have named DSEAndrewGrid so you can find it easily in the attached sample. If you set the Tooltip property on this grid, you can set a custom tooltip on an appointment by setting this ControlTemplate to the Template property of the AppointmentPresenter style mentioned above.
The DataItem of an appointment is the appointment, so to bind a tooltip to a business object, I would actually recommend writing a custom class that extends Appointment and add a public object property that you can set to your business object. After this, you can bind the grid’s tooltip property to MySettableDataItemProperty.SomeProperty.
The attached sample application demonstrates the above.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
Just checking in, did you have any other questions or concerns on this matter?