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

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 ?

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

1 answer

Sort by: Most helpful
  1. essamce 581 Reputation points

    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 }">

    No comments