Silverlight control template


Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Silverlight control template

  1. 1. Control Template in Silverlight<br />Mahender<br />Senior Software Engineer<br />United Health Group<br />
  2. 2. Mahender Sarangam<br />Having close to 5 years of experience. Working as a Senior Software Engineer in United Health Group. Good Knowledge on C#, ASP.NET, Silverlight, WPF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. MCTS Certified in Web Applications.<br />
  3. 3. Control Template<br />A Control Template specifies the visual structure and visual behavior of a control.<br />Customize the look and feel of a control by giving it a new Control Template<br />When you create a Control Template, you replace the appearance of an existing control without changing its functionality.<br />A Control Template must have only one root element that derives from Framework Element<br />
  4. 4. Control templates: All Silverlight controls are look less, which means they have hardwired functionality, but their appearance is defined separately through the control template.<br /> Replace the default template with something new, and you can revamp basic controls such as buttons, check<br /> boxes, radio buttons, and even windows.<br /> Before After<br />
  5. 5. Content Presenter<br />When you define a Control Template, you must tell Silverlight where to place that Content. To help you do this task, Silverlight provides two Framework Element instances: Content Presenter and Items Presenter.<br />If we are template content controls like button, label etc, we have to use content Presenter to show content<br />
  6. 6. Item Presenter<br />Item Presenter is the placeholder to show the each item in item panel ,it is similar to content presenter. But Item Presenter are used for control like Item Control . For example , we use item presenter for control like list box ,Data grid etc.<br />For Scroll viewer, since the item has to move , we use ScrollContentPresenter for showing contents in Scrollviewer.<br />
  7. 7. Control Templates and Data templates Differences<br />Data Template is used to create a visualization of a non-visual object, such as a business object. <br />Control Template supplies a visual representation of a UI control, such as a Button or List View.<br />A Data Template, therefore, is used to provide visual structure for underlying data, while a Control Template has nothing to do with underlying data and simply provides visual layout for the control itself.<br />A Control Template will generally only contain Template Binding expressions, binding back to the properties on the control itself, while a Data Template will contain standard Binding expressions, binding to the properties of its Data Context<br />
  8. 8. DEMO<br />
  9. 9. Thank you!<br />