Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
DataTemplate in Generic.xaml – it should be the next ToString()!

Developers often find some benefit by implementing an override for ToString(). I believe that we could make providing a DataTemplate in generic.xaml very beneficial as well. First we have to start a beneficial cycle…

What could be done with it:

  • Apps that use that object in their UI, would have a default data template.
  • Tools that help build UI could have a better default data template.
  • Visualizers of generic object graphs (like debuggers) could have a better visual representation.
  • more…

How to create a default DataTemplate for your type:

  • Start with a WPF or Silverlight Control Library project
  • Create the class in that project
  • Modify themes\generic.xaml to contain a DataTemplate with DataType=”{x:Type l:MyType}”
    • (Silverlight doesn’t yet support this…so perhaps you could give your DataTemplate a key of “defaultViewForMyType”)

Thoughts?

Would love to hear what you think…

Published Sunday, March 07, 2010 6:10 AM by Rob_Relyea

Comments

# Dew Drop – March 8, 2010 | Alvin Ashcraft's Morning Dew@ Monday, March 08, 2010 7:20 AM

Pingback from  Dew Drop – March 8, 2010 | Alvin Ashcraft's Morning Dew

# re: DataTemplate in Generic.xaml – it should be the next ToString()!@ Wednesday, March 31, 2010 6:56 PM

I love that idea

by Kevin Daly

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Page view counter