Reputation: 1529
I am c# silverlight(5) beginner and not a bit know about how to make tool tip. In fact i couldnt find any option in toolbox for tool tip.
What i have to do is to show a tooltip when mouse hover a button. Suppose if i have button like this :
<Button Content="{Binding Path=Id}"
Command="{Binding DataContext.ShowPopupCommand,
RelativeSource={RelativeSource AncestorType=data:DataGrid}}"/>
Now how to create a ToolTip on this button in ViewModel.cs class ?
Could someone please give me guidance on how to create ToolTip in c# silverlight application using MVVM approach. Any piece of code for help is really appreciated. Would be a great help. Thanks.
Upvotes: 0
Views: 3554
Reputation: 6156
<Button
ToolTipService.ToolTip="ToolTip based on the mouse."
ToolTipService.Placement="Mouse"/>
If you need to display any FrameworkElements
(and not just text) you can set the tooltip like this:
<Button>
<ToolTipService.ToolTip>
<Border Background="Pink">
<StackPanel>
<Image .../>
<TextBlock .../>
</StackPanel>
</Border>
</ToolTipService.ToolTip>
</Button>
Upvotes: 4
Reputation: 179
Try this
<Button Content="{Binding Path=Id}"
Command="{Binding DataContext.ShowPopupCommand,
RelativeSource={RelativeSource AncestorType=data:DataGrid}}"
ToolTip="{Binding SomeProperty}"/>
Upvotes: 1