WPF user control design patterns. MVVM?

I create a custom control in WPF, this is a very non-original example of a stock ticker that I get from the Control type. My question is: are there any recommended design patterns for the controls themselves (as opposed to the application)? I use MVVM for the application as a whole, but just wandered if it is good or bad practice to use such a design pattern with the control itself.

My reasons to think about using MVVM for a control:

  • This is a relatively complex control, because it has the ability to graph and the dependency properties of Midprice, Average, etc. etc.
  • To have ViewMOdel as part, it will simplify (or even possibly) unit testing
  • Makes the whole coding process simpler, especially since I have an order for the ObservableCollection of point types.

Any thought on this subject would be brilliant. I just don't know if this is good practice or not.

Many thanks

+3
source share
2 answers

If the control itself is self-sufficient and complex enough to be called by itself, I would go with the approach to creating a separate presentation model for the control itself, as you suggest. Otherwise, I just let him live in the view in which he is placed.

0
source

1) - , , .

2) API - , .

3) - . MVVM. . , , , MVVM .
4) - . [ , , .;)]
5) . . L

:
, . , . , .

, :
1)
2) .

+2

Source: https://habr.com/ru/post/1759836/


All Articles