Reputation: 27673
I have a button with a ToolTipService.ToolTip
in it.
How do I access it in code?
e.g.
<Button Name="testButton">
<ToolTipService.ToolTip>
Test
</ToolTipService.ToolTip>
</Button>
Upvotes: 2
Views: 2451
Reputation: 34286
To get the value of an attached property, use the provided static method:
var tooltip = ToolTipService.GetToolTip(testButton);
If there is no such static method (not likely, all classes should have static helper methods to get/set attached properties they expose), then use:
var tooltip = testButton.GetValue(ToolTipService.ToolTipProperty);
Upvotes: 7