In WPF which is better MVVM way of loading an userControl/customcontrol from a different library project into mainWindow XAML

Arathi Jinde 6 Reputation points
2021-03-23T06:33:12.753+00:00

there is seperate library for usercontrol which has to be loaded in another exe console project which is better approach for the same 1. using contentcontrol and set the content to the user control 2. refer the library in the mainwindow.xaxml and add the usercontrol inside the xaml <lib:userControl> or any other better way of achieving this ?

XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
765 questions
{count} votes

1 answer

Sort by: Most helpful
  1. essamce 621 Reputation points
    2021-03-23T20:46:56.963+00:00

    hi @Arathi Jinde
    i think user control is meant to be project specific unlike custom control which meant to be a general purpose, however regarding your question since you didn't show your code we assumed the UserControl has it's viewmodel
    you likely will use it like so <lib:UserControlView DataContext="{Binding UserControlViewModel }">

    0 comments No comments