Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between View and Usercontrol when doing MVVM

Tags:

mvvm

wpf

lately i often see questions regarding MVVM and usercontrol, where - for me - view and usercontrol are mixed up.

for me a View when doing MVVM is just a pretty interface that allows users to interact with my ViewModels - so at least a collection of controls with Bindings. most time xaml only but codebehind not forbidden.

for me a usercontrol instead is not related to a viewmodel at all. the usercontrol has a representation in xaml and of course codebehind where properties, methods and Dependency Properties exist.

i'm on a wrong way with that?

EDIT: of course view and usercontrol inherit from UserControl class - so both technically UserControls. but i use just the term View when doing MVVM. and the term usercontrol just when there is no direct relation to a viewmodel.

ps: my english is too bad to write down what i mean...

like image 219
blindmeis Avatar asked May 16 '26 08:05

blindmeis


1 Answers

You're not wrong just consider the fact the user control can be a reusable view that has a view model. cause the entire composite ui architecture is based on s shell(main window, view) and some regions with view (user controls)

like image 193
Chen Kinnrot Avatar answered May 19 '26 04:05

Chen Kinnrot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!