Question

I want the controls in my wpf window to change depending on whether the user is viewing or editing/inserting data. For example, I want to display a label at view time, but a text box (or combo box etc) at edit/insert time.

Can I do this with DataTemplates or do I have to have two controls for each data item and change visibility depending on what mode the form is in?

If DataTemplates will do the job, can anybody point me to some examples?

many thanks mcalex

Was it helpful?

Solution

In my opinion, the better way to do this is using differrent data templates for control, in case when you always need to use them together. In any case you have to select switch templates or controls mechanism. You can use DataTrigger (first answer) or ValueConverter

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top