What is the best way to reuse an vista.xaml, which belongs to another class library (another module) in WPF using MVVM?
What is the best way to reuse an vista.xaml, which belongs to another class library (another module) in WPF using MVVM?
If you mean to use different Views with the same ViewModel, I do not recommend it at all. When I started with WPF I tried it and then it was a disaster to keep it. Ideally, each view has an independent ViewModel associated with it.
On the other hand, if you want to make reusable components, you can create a library of user controls (UserControl), each with its XAML and its CodeBehind, which you can use in all the projects you need.
The simplest way is to create a project of type WPF User Control Library
there you define that view as control.
Then you add the reference to the project, in order to define the namespace in the xaml, if you want to define the view, something like
xmlns:vc="clr-namespace:NombreControlLibrary;assembly=NombreControlLibrary"
You will notice that being a separate project you must define the name of assembly
How to: Import a Namespace into XAML
Note: If in the link you change the en-US
by es-ES
you can see the article in Spanish