Reputation: 943
How do I add different tooltips to the shapes in the WPF zoomable canvas discussed in the msdn blog: http://blogs.msdn.com/b/kaelr/archive/2010/08/11/zoomableapplication2-a-million-items.aspx ?
I tried adding a tooltip using binding, but that doesn't seem to work. The shapes are added as list box items.
Any help is appreciated. Thanks!
Upvotes: 1
Views: 1257
Reputation: 5325
That example is nothing like how I would have programmed it, but nevertheless it works. To add ToolTip's to that example do the following:
Add ToolTip to this Style
<Style TargetType="ListBoxItem">
...
<Setter Property="ToolTip" Value="{Binding toolTip}"/>
</Style>
Add toolTip reference in GridLikeItemsSource.cs
public object this[int i]
{
...
var height = rand.Next(50, 100);
var toolTip = "ToolTip";
...
return new { top, left, width, height, data, brush, i, toolTip };
}
Upvotes: 1