![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | What is the difference between DataTemplate and ControlTemplate Hi, everyone Can anyboday tell me why it is nessary for both DataTemplate and ControlTemplate to exist? Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| | Re:What is the difference between DataTemplate and ControlTemplate datatemplate is how to style the data and controltemplate is to style the control(how the control looks |
My System Specs![]() |
| | #3 (permalink) |
| | Re: What is the difference between DataTemplate and ControlTemplate More Specifically: A ControlTemplate is used to define/change the way a class derived from Control looks... Buttons, ListBox, ScrollBar, ... However, some "Controls" you use are not derived from Control: Best example is the TextBlock class. The TextBlock cannot have a ControlTemplate. Alternatly, the concept of DataTemplate is closelly linked with the Content Model in WPF application. Certain controls are made to display "Content"... The content can be anything... An Image, Text, an Object.... in fact, it is defined as an "object" type. The DataTemplate simply defines how a particular content (or content type) is meant to be displayed... Example: Usually, a string is displayed using a simple TextBlock... However, if you want a custom text layout, decoration, alignement, ... you would need to define an Alternate DataTemplate. I hope this clears the topic a little more... |
My System Specs![]() |
| | #4 (permalink) |
| | Re: What is the difference between DataTemplate and ControlTemplat Ok, I've understood it to some extent. Thanks a lot. |
My System Specs![]() |
| | #5 (permalink) |
| | Just wanted to add that you can take a look at the before/after screenshots at the top and the bottom of this page: http://windowssdk.msdn.microsoft.com...75ec07da2e.asp The ListBox at the top... a ControlTemplate is used to define the visuals of ListItems (what the Border looks like, what happens when an item is selected). A DataTemplate is used to describe how the Photo objects (the content/data items) should be displayed (in this case, as images instead of filenames). Hope this helps, Tina |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| DataTemplate | .NET General | |||