jagguy
asked on
templates in silverlight
Hi,
Can someone clarify what templates are in silverlight .net as I am getting confused with what i have got.
These 3 objects do what
ContentTemplate property
ContentControl
DataTemplate.
Can someone clarify what templates are in silverlight .net as I am getting confused with what i have got.
These 3 objects do what
ContentTemplate property
ContentControl
DataTemplate.
ASKER
thankyou I will look over what you said
ASKER
I am not understanding how to use contentControl or why you need it. Why have it?
You can display data styled is that the idea?
It is hard finding a simple example on this but can someone give me a small code snipper to see it working in .net?
You can display data styled is that the idea?
It is hard finding a simple example on this but can someone give me a small code snipper to see it working in .net?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i guess if i was to build my own controls then i see a use but your right , I mean why bother having this control in silverlight?
DataTemplate/ItemTemplate is very useful for controls that access data, like DataGrid or ListBox. Inside your control (lets say ListBox) you would create an ItemTemplate and define how you want things to look for one item. You could databind an image URI to an Image control, a name field to a TextBlock, and add a "Delete" button all at once, and then Silverlight will use that template for as many items that get bound to that list.
For a great example of the DataTemplate/ItemTemplate see ScottGu's Digg example (http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx). It was made for beta 1, though, so it may not build anymore with beta 2 but at least his tutorial and code will go a long way. For great info on styling controls, see Karen Corby's blog. Start here (http://scorbs.com/2008/06/11/parts-states-model-with-visualstatemanager-part-1-of/) if you like.