James Hay
James Hay

Reputation: 12700

Dynamic DataTemplates (pref. Silverlight)

Is it possible to have a ListBox with a Data Template that changes depending on certain properties of the ItemsSource? For instance maybe you want a list with a variety of items such as images, video, custom panels, etc. Was hoping it could behave like some sort of factory.

Any ideas how this would work?

Upvotes: 1

Views: 337

Answers (1)

Steven Robbins
Steven Robbins

Reputation: 26599

In WPF land you'd use a DataTemplateSelector, which unfortunately doesn't exist in Silverlight, but there are several articles, like this one, around showing how to put something similar together.

Upvotes: 3

Related Questions