Click here to Skip to main content
13,298,655 members (65,621 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 2 Nov 2010

ToolTip for Disabled Element in Silverlight.

, 13 Nov 2010
Rate this:
Please Sign up or sign in to vote.
ToolTip for Disabled Element in Silverlight

I noticed that there are many conversations departing in Silverlight forums regarding tool tip support for disabled elements in Silverlight. Silverlight program manager also accepts here that having the ToolTip not show on a disabled element is by design. However some folks suggesting mouse enter and mouse leave, and some evoking style modification, etc... But these approaches are not applicable when you develop your Silverlight application in MVVM pattern. Here is the simple approach that helps you to set tooltip for disabled item.

Host a rectangle on top of your element in a grid and bind the visibility property of the Rectangle with IsEnabled property of target element (Make sure that you have BooleanToVisibilityConverter like the one in WPF). And bind your business property with tooltip of the rectangle as well as for your target element if you want to display in enabled state also. And also don’t forget to bind Rectangle Width and Height property with ActualWidth and ActualHeight of Button.

Here is the code.

<Grid Margin="30,0,20,0">
<Button x:Name="MyButton" Content="See My ToolTip when I am in Disabled" IsEnabled="{Binding Path=IsEnabled}"/>
<Rectangle x:Name="toolTipForDiabledButton" Visibility="{Binding Path=IsEnabled, ElementName=AddButton, Converter={StaticResource BoolToVisibilityConverter}}" ToolTipService.ToolTip="{Binding Path=MyToolTip, Mode=TwoWay}" Fill="Transparent"
Width="{Binding Path=ActualWidth, ElementName=AddButton}" Height="{Binding Path=ActualHeight, ElementName=AddButton}">

Hope this helps the MVVM folks.


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


About the Author

Software Developer (Senior) Logitech Engineering & Design (India) Pvt. Ltd.
India India
Venugopal works as a Senior Software Engineer in Logitech Engineering & Design (India) Pvt. Ltd. He hold a Masters in Computer Applications and has 4+ years experience in C#, XAML, Silverlight & WPF.

Venugopal firmly believes "technology is impermanent, change is not"!. While he has strong technical inclination towards MS technologies, he is deeply passionate about pursuing his career in Windows7-WPF and Silverlight Technology.

Venu engages in a wide gamut of temperamental hobbies ranging from making friends, traveling, helping his friends studies. To murmuring songs and watching movies in leisure time.

You may also be interested in...

Comments and Discussions

QuestionTwoWay tooltip binding? Pin
mtiede23-Jul-14 11:56
membermtiede23-Jul-14 11:56 
SuggestionNice Tip Pin
JJPWebLife19-Jun-12 9:43
memberJJPWebLife19-Jun-12 9:43 
GeneralCheeky :) Pin
Member 54296208-Nov-10 18:06
memberMember 54296208-Nov-10 18:06 
GeneralReason for my vote of 5 Good one. Pin
PumbaPumba3-Nov-10 5:09
memberPumbaPumba3-Nov-10 5:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171207.1 | Last Updated 13 Nov 2010
Article Copyright 2010 by venugopalm
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid