Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
505
UltraMonthViewSingle and tooltips
posted

I would like the user to be able to receive a tooltip that is date specific when he hovers over a particular day.  I have done this (successfully) with grids by using the following trick.

 

 

private void _ctrlWSDataGrid_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)

{

      UltraGridCell cell = e.Element.GetContext(typeof(UltraGridCell)) as UltraGridCell;

      ShowToolTipForCell(cell);

}

I'm not sure if this is the preferred way, but it does the job.  For the calendar, UltraMonthViewSingle, I'm a little stuck.  I've tried the ideas below, with no success.  How does one get a hold of a single day in the calendar?  Incidentally, I did it in the MouseClickEvent for other purposes by just using _ctrlViewWeatherCalendar.GetDayFromPoint(...), but obviously I don't want the user to have to click on a cell just to get a tooltip.  Any suggestions to get this working? Or is there a whole other approach?  Keep in mind that the tooltip that I'm ultimately trying to display will have information from the datasource that the calendar is bound to and will not just be a date.  For example the tooltip might show the average price of a stock for that day.

Here's what I have so far:

private void _ctrlViewWeatherCalendar_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)

{

      // Figure out the 'element' we entered, like a day element

      UltraMonthViewSingle thing = e.Element.GetContext(typeof(UltraMonthViewSingle)) as UltraMonthViewSingle;

// thing is a whole Month!!!

      DayUIElement dui = e.Element.GetContext(typeof(DayUIElement)) as DayUIElement;

// dui is NULL!!!

 

// fake the date for now….         

DateTime date = new DateTime(2009, 7, 1);

ShowToolTipForDay(date);

}

 

Parents
No Data
Reply
  • 69832
    Suggested Answer
    Offline posted

    Just check "e.Element is DayUIElement" instead. GetContext will give you the underlying "thing" associated with the element, but the Infragistics.Win.UltraWinSchedule.MonthViewSingle.DayUIElement is the UIElement, not the underlying thing. You could also try passing typeof(DateTime) to GetContext, but you might get one back from other elements, which would cause you to show tooltips for other things, which you might not want.

Children
No Data