Combining controls
When we need to arrange a number of existing controls in a particular way, we typically use a UserControl
object. This is why we normally use this type of control to build our Views. However, when we need to build a reusable control, such as an address control, we tend to separate these from our Views, by declaring them in a Controls
folder and namespace within our Views project.
When declaring these reusable controls, it is customary to define Dependency Properties in the code behind and as long as there is no business-related functionality in the control, it is also ok to use the code behind to handle events. If the control is business-related, then we can use a View Model, as we do with normal Views. Let's take a look at an ...
Get Mastering Windows Presentation Foundation now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.