In this post I will show you how to create Image Button using Attached property in silver light application. You can see the output of the example code in the Image 1and what I want to achieve by using the attached property. Here you can see that i have image and text in a button control of the silver light.

Image 1

Code for the attached property is listed in List 1. Here you can see that I have static class with the name ImageButton. The in the class I have IconProperty. I have pass the property name "Icon" which is of type ImageSource and the owner is the ImageButton class. Then I have the GetIcon and SetIcon property of type ImageSource.