Tutorial: Creating a Custom Skin
Creating a Custom Skin for RadToolTip for ASP.NET AJAX from an Existing One
In order to explain better the CSS classes of RadToolTip, we will use ToolTip.SkinName.css as external resources. We will modify an existing skin of RadToolTip. Follow these steps to register an external skin for RadToolTip for ASP.NET AJAX before editing any CSS:
In your project, create a new directory named Skins
In the Skins folder create a new directory MyCustomSkin.
Go to ~/[TelerikControlsInstallationFolder]/Skins/Default and copy Tooltip.Default.css and the Skins/Default/Tooltip folder in your Skins folder.
Rename Tooltip.Default.css to Tooltip.MyCustomSkin.css and the folder Default to MyCustomSkin.
When you are finished you should have Skins/MyCustomSkin/Tooltip.MyCustomSkin.css and Skins/MyCustomSkin/Tooltip. The last folder contains the images for MyCustomSkin.
-
In order to support multiple skins of RadTooltip on a single page, the wrapping skin-specific class is coined by the name of the control, RadTooltip plus underscore ("
_
") plus SkinName, i.e. .RadTooltip_Default, so in order to create a custom skin out of the Default skin, we should rename all occurrences of "Default" in Tooltip.MyCustomSkin.css to "MyCustomSkin" as shown below: -
Add a new server declaration of RadTooltip on your page, and set Skin="MyCustomSkin" and EnableEmbeddedSkins="false":
ASP.NET
<telerik:RadToolTip RenderMode="Lightweight" runat="server" ID="RadToolTip1" EnableEmbeddedSkins="false" Skin="MyCustomSkin"> </telerik:RadToolTip>
-
Register Tooltip.MyCustomSkin.css in the
<head>...</head>
section of your webpage. In order to have the CSS applied correctly, the base stylesheet should come first in the DOM:HTML
<link rel="stylesheet" type="text/css" href="Skins/MyCustomSkin/ToolTip.MyCustomSkin.css"> </link>
Make sure the path to the files is correct, otherwise the skin will not apply.
Reload the page, and if the steps 1-8 have been followed correctly, you will see RadTooltip running a custom Default skin set as an external resource.
RadToolTip for ASP.NET AJAX CSS: Classes and Their Use
The Skin Stylesheet - ToolTip.MyCustomSkin.css
Main CSS Classes
.RadToolTip_MyCustomSkin.rtLoading loading image of RadToolTip
div.RadToolTip_MyCustomSkin wrapping class
div.RadToolTip_MyCustomSkin div.rtCallout tooltip tail wrapping class
div.RadToolTip_MyCustomSkin.rtVisibleCallout div.rtCallout tooltip tail wrapping class
div.RadToolTip_MyCustomSkin table.rtWrapper wrapping table of the control
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperTopLeft, div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperTopRight, div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperBottomLeft, div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperBottomRight tooltip corners
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperTopLeft top left corner
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperTopRight top right corner
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperBottomLeft bottom left corner
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperBottomRight bottom right corners
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperBottomCenter bottom center
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperTopCenter top center
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperLeftMiddle,
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperRightMiddle left and right middle
div.RadToolTip_MyCustomSkin table.rtWrapper td.rtWrapperContent content cell
div.RadToolTip_MyCustomSkin div.rtTitlebar titlebar
div.RadToolTip_MyCustomSkin a.rtCloseButton close button
Understanding the Image Sprites
Each skin of RadToolTip consists of three image sprites, that are contained in the Skins/SkinName/RadToolTip folder. These are:
Callouts.gif - the images for RadToolTip's buttons, as well as their hover states:
ToolTipSprites.gif - the horizontal sprites for the control
ToolTipVerticalSprites.gif - the vertical sprites for the control
Loading.gif - the loading indicator for the control
Below are visual schemes of the image sprites that are used to skin RadToolTip.
Modifying the Image Sprites to Achieve Totally New Looks for the Skin
Explained below is a simple method for modifying the image sprites of RadToolTip with Adobe© PhotoShop to achieve new looks without creating a new design.
Drag Callouts.gif, ToolTipSprites.gif andCommandButtonSprites.gif in Adobe© PhotoShop
-
From the menu bar select Image » Mode » RGB Color to prepare the images for editing (convert from optimized Indexed Color to RGB Color):
-
Press Set Foreground Color in PhotoShop's toolbox to invoke the color picker dialog:
-
Select a color that you like from the color dialog and then close it:
-
Select Image » Adjustments Hue » / Saturation to open the Hue / Saturation dialog of Adobe© PhotoShop:
-
Check the colorize checbox in the Hue / Saturation dialog, and the image you have selected will be immediately colorized in the hue you have selected from the toolbox:
You may then play with the Hue, Saturation and Lightness sliders to fine tune or further modify the image. Make sure you memorize the values of the sliders, as you will need to add the same settings to all three images in order to achieve consistent looks
Press "OK" when you are finished
Select Image Image » Mode » Indexed Color to flatten the layers of the image
Save and close the image
Repeat Steps 5 - 9 for each of the remaining images
-
After you are over and done with this, save your work and reload the page. You will have a brand new skin based on Telerik's Default skin of RadToolTip.