In the default list of controls comes with Silverlight 4 or 5, there is no such control like Image Button. But the creation of this control is very easy. Lets start to create Image Button.
Steps: -
1) Create a Silverlight User Control in your Silverlight project. Change its type to Button. I have given the XAML and C# code below.
XAML Code:
<Button x:Class="KnowledgeWeb.Assets.ImageButton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="80" d:DesignWidth="80"> <Grid x:Name="LayoutRoot" Background="White"> </Grid> </Button>
C# Code:
namespace KnowledgeWeb.Assets { public partial class ImageButton : Button { public ImageButton() { InitializeComponent(); } } }
2) Now to show an image on the button we have to edit the default template of the button class and then inserts the Image control in it.