Custom ToolTips for tasks
Note: This is illustrated in sample "Appearance\GanttControlCustomAppearance".
The GanttControl lets you to easily customize the look and feel of the tooltips that get displayed for each task bar.
First define a IValueConverter where you can convert a "IActivityView" instance to a ToolTip Content:
// Custom ToolTip content provider
public class ActivityViewToToolTipContentConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
IActivityView view = value as IActivityView;
// Return a UI Element that will be the content for the tooltip:
// To get hold of the IActivity instance.
// view.Activity;
// To get hold of the data source (TaskInfo, in this case) bound to this activity:
// TaskInfo ti = ((DataBoundActivity)view.Activity).DataSource as TaskInfo;
Grid grid = new Grid();
TextBlock tb = new TextBlock();
tb.Text = view.Activity.Description;
grid.Children.Add(tb);
return grid;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
Then in your XAML resource:
<local:ActivityViewToToolTipContentConverter x:Key="tooltipConverter"></local:ActivityViewToToolTipContentConverter>
And refer to the above resource in the ToolTipContentBinding property of the GanttControl:
<gantt:GanttControl x:Name="ganttControl"
ToolTipContentBinding="{Binding Converter={StaticResource tooltipConverter}}"
/>
� RadiantQ 2009 - 2019. All Rights Reserved.