Question

I normally just use UserControl for a view, but during this project I thought it might be better to derive a View class from that, and use that as the 'containing' class for views, to allow me to possibly later inject more functionality into a View. However, I wasn't using Prism then, so I had much fewer luxuries etc. that an established framework brings.

Should I keep this practice, or are plain UserControl views ample enough?

Was it helpful?

Solution

I think that's a matter of the requirements for your Views. As you said, that approach gives you the flexibility of adding functionality to your View class and having it instantly available in all your Views.

However, as the focus in the View is usually put in maximizing the XAML and minimizing the code-behind (a good example for this are behaviors), I think your common base View class approach might somehow move you in the other direction. Whatever you'd put into that class, try to achieve it through XAML and behaviors.

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