A: 

With a ListBox, you can specify a DataItemTemplate - just put whatever controls you want in that DataItemTemplate (e.g. you might want multiple TextBlocks), and bind them to whatever properties you want on the bound object.

To load the DataItemTemplate dynamically, you can use the same technique as illustrated in this blog post.

slugster
can i do all these things from code? instead of xaml
taher chhabrawala
See my edit....... the blog post uses a ControlTemplate, but you can do the same with DataTemplate.
slugster
can i make the DataTemplate at runtime, because i dont know what type of objects will come into my list and what properties will they have,i have a requirement of of dynamically selecting a object type and then select its properties to be displayed in list box
taher chhabrawala
+1  A: 

Its not possible to programmatically create the content of a data template in the same way you might create Controls and add them to a UserControl.

Instead you will need to use System.Xml.Linq.XDocument to construct the DataTemplate as XML with DataTemplate being the root element. Once complete you can retrieve the XML string for the Root element and then use XamlReader.Load to get a constructed DataTemplate.

AnthonyWJones