views:

49

answers:

2

Hi,

Is there a simple way in WPF to create a usercontrol with different modes for display, update or insert a new object?

I'm thinking (coming from a web background) something like a listview control where you can create display templates for the different modes. You can then quickly change the mode, depending what you need to do.

Any links that points me in the right direction is very welcome.

Thanks

A: 

The closest option to what you're thinking would to be to use a DataTemplateSelector. Set ListView.ItemTemplateSelector to an instance of your class, and then based on the current mode of your app you can return the appropriate template for that mode.

Andy
A: 

You might also consider using the VisualStateManager to create states for your control for each of the modes, and then change the template (or parts of the template) based on the state of the control.

Nicholas Armstrong