Thursday, April 07, 2011

How to design a Custom Control by editing the Part Template?

This is a continuation to my previous post "How to create a Custom Control in Silverlight?" In this tutorial part, we will discuss on the template and modify our basic template to give a better look as per our need. In this chapter, we will learn about template Part and how to modify the existing template.
Read out more to learn in depth about Custom Control in Silverlight. This will benefit you not only for Silverlight but for WPF and Windows Phone 7 development too. At the end, never forget to provide your feedback.
As mentioned, this is the continuation to my previous post "How to create a Custom Control in Silverlight?", that I posted yesterday. Here we will learn about Template Parts. Hope this will clear the basic idea behind custom controls. It's not at all hard if you understand it properly.
So, let's begin with the post. Hope, you have the previous example intact with you.
Modifying the Template
Open the Generic.xaml page. As shown earlier, you have the following style present in your file. As marked below, you have the ControlTemplate and inside that you have a border control. We will now modify this template to give a better look to our control with a header title and a content area.

image%5B14%5D.png?imgmax=800
Read more: Kunal's Blog