Click here to Skip to main content
15,916,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Lets say I have following code in a WPF Window:
XML
<ct:CustomClass.CustomStack>
                        <StackPanel Name="TB1">
                            <Button ToolTip="Test Tip" BorderThickness="1" BorderBrush="Black" Name="btnModifier" Content="Click here"></Button>
                        </StackPanel>
                    </ct:CustomClass.CustomStack>


Where I have a custom stack panel property where I am adding a stackpanel with children in it.
Now as we see button has a tooltip here which will be displayed when mouse will hover on it.
I have no control over the button as it lies inside another window (some host application using my custom class).

Main question is I want that the tooltip for child control in stackpanel should never appear at runtime during mouse hover. How to achieve this in my custom class?

Note: I don't have any control over code in Host application window.xaml
Posted
Updated 8-Aug-12 22:21pm
v6
Comments
Kenneth Haugland 9-Aug-12 2:53am    
Are you using styles to set the tooltips on the controls?
Kenneth Haugland 9-Aug-12 3:03am    
You question is not quite clear, as I dont see exactly what you want. Could a see a simple code snipplet with the problem?
Versatile49 9-Aug-12 3:02am    
No directly it can be set when the control is declared in a WPF Application. But what is the difference. User can update the value of tooltip at runtime also.
Versatile49 9-Aug-12 3:15am    
Updated the question. Let me know if you need more details

1 solution

I would insted binded the Tooltips to an Observable collection of string, and binded these to the elements as they get added. MAkes it simpler.

You can however set the style on only the elements within the stackpanel see here:
http://stackoverflow.com/questions/1366598/apply-style-to-all-treeviewitem[^]
http://stackoverflow.com/questions/1465806/applying-wpf-styles-to-child-items[^]
 
Share this answer
 
Comments
Versatile49 9-Aug-12 4:04am    
I think you didn't understand my question.

First of all the thing is I don't have contorl over the host application window as another user can use the same class. I cannot ask them to bind it to observable collection and perform certain actions on it.
Second of all the main thing is I want is that tooltip should never appear when the control is added to the stackpanel. How to achieve this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900