Silverlight Templates - Microsoft Silverlight

What is Silverlight Templates?

A Template defines the complete look and visual look of the control. For each control, there is a default template related with it, which offers the appearance to that control.

In WPF application, you can easily create your own templates when you want to customize the visual behavior and visual appearance of a control.

Some important features are −

  • All of the UI elements have some kind of appearance as well as behavior e.g. Button has an appearance and behavior.
  • Click event or mouse hover event are the behaviors, which are fired in response to a click and hover and there is a default appearance of button, which can be changed by the Control template.

Let us look at a modest instance again in which a button is defined with template.

When the above code is compiled and executed, you will see the following output.

Connecting the Template

All of the control features, which we want to template, are with template bindings. Some features are a little more difficult. For instance, anytime you have a form of content model, Template binding alone is not enough that you saw on the button. We also have to use a content presenter as shown in the instance overhead.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Microsoft Silverlight Topics