Thursday, May 26, 2022 ..:: ::.. Register  Login
 Bloggers Minimize

 Sponsors Minimize

 Users Online Minimize
Membership Membership:
Latest New User Latest: HarrisSampso
New Today New Today: 10
New Yesterday New Yesterday: 6
User Count Overall: 9826

People Online People Online:
Visitors Visitors: 17
Members Members: 0
Total Total: 17

Online Now Online Now:

 Welcome to! Minimize

If you are a developer or designer who is creating cutting edge user interface experiences using Microsoft Expression Blend you've just found a great resource!  The purpose of this site is to share our experience with this brand new product.  As with any new piece of software there is a ton to discover.  Bugs will be revealed and workarounds discovered, hopefully this can be a resource to share in the discovery process!

While this site will focus largely on Expression Blend, it will also encompass WPF, Visual Studio, Silverlight, and other .net 3.5 technologies as they relate to the creation of great software.

Please login using your Microsoft LiveID or register a new account.  Doing so will let you comment on any of the blog entries on the site.  We look forward to helping you in your endeavors as well as you helping others in theirs!  We'd love to have more bloggers on our site...if you are interested please register and contact us!

Follow us:

 Datatemplate trick Minimize
Location: BlogsSean Cullinan    
Posted by: Sean Cullinan 1/24/2008 9:52 PM

Here's a quick one.  Lets say you are binding a combobox to a ItemsCollection.  The items are all going to be of type "card" which has a property of color and name.  You select your listboxes ItemSource only to realize that you can't see the color and name properties of "card" you can only see the properties of an ItemsCollection.  When you go to define the data template the properties associated with "card" are no where to be found.

The solution I had to this very scenario is to add a CLR data object and specify the type as "card."  Then temporarily bind the itemsource on your combobox to this clr data object and define your data template.  Once you've done this, remove your CLR data object (and dataset) and bind the itemsource on your combobox to your ItemsCollection.  Select Define DataTemplate and select "Current or Predefined Data Template."  You will now see the datatemplate that was created earlier when you bound to the CLR object which is exactly the template you want to use!  Removing the clr data object doesn't remove this template...thank goodness!  This works like a charm and lets you use the visual advantages of Blend to build your datatemplates even when you are binding to a generic ItemsCollection.

Permalink |  Trackback

Your name:
Add Comment   Cancel 

 Search Minimize

 Archive Minimize

 Blendblog Survey Minimize
Our next client application will be written using:

Which Tablet Do you expect to buy?

Submit Survey  View Results

Copyright 2011 by   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2022 by DotNetNuke Corporation