1. Control Template in Silverlight Mahender Senior Software Engineer United Health Group
2. Mahender Sarangam 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.
3. Control Template A Control Template specifies the visual structure and visual behavior of a control. Customize the look and feel of a control by giving it a new Control Template When you create a Control Template, you replace the appearance of an existing control without changing its functionality. A Control Template must have only one root element that derives from Framework Element
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. Replace the default template with something new, and you can revamp basic controls such as buttons, check boxes, radio buttons, and even windows. Before After
5. Content Presenter 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. If we are template content controls like button, label etc, we have to use content Presenter to show content
6. Item Presenter 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. For Scroll viewer, since the item has to move , we use ScrollContentPresenter for showing contents in Scrollviewer.
7. Control Templates and Data templates Differences Data Template is used to create a visualization of a non-visual object, such as a business object. Control Template supplies a visual representation of a UI control, such as a Button or List View. 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. 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