I work with a project on WPF, the interaction (communication) between View and ViewModel is performed via catel. Each xxxView.xaml representation corresponds to the xxxViewModel.cs model, but it turns out that there are single-type views in which only the names and values ​​of the parameters change (markup by template).

Is it possible to change the data in one template (window call) in one template (we now have 15 pages of the same type with different keys for headers)

  • I understand that you only learn to write in the framework of MVVM? If yes, then I strongly advise you not to use any framework like this for your catel at this initial stage. As in your case there is a substitution; you do not study the underlying principles and general ways of implementing MVVM, but study a specific implementation, how it is done in this or the framework. As a result, you will "swim" and poorly understand how and what works and why it is done this way and not otherwise. xxxViewModel.cs - this is not a model file, but a view model. - Bulson
  • You are right, the view model (as written there). In the model folder, I receive values ​​from the base and transfer them to the corresponding model view. And you can tell how to do this in the framework of MVVM? - Neznaika
  • As part of the commentary, I can only outline in general terms. Create a class, say MainViewModel , in it you need to create properties for all the necessary controls from MainWindow, with which you will work with data from the database. Bind together the view model and the window (for this is the DataContext ), then bind in the controls to the properties of the view model. Search the Internet for a ready implementation of RelayCommand , copy it to your project and use it to implement the commands for the buttons. In the constructor of the view model or on command, load data from the database into the model classes and forward. - Bulson
  • I once wrote a simple example to demonstrate a simple application framework. There is no work with the database and data, but there are examples of working with teams, with different view models and views. Download and see, everything is simple and done without framework frameworks. - Bulson
  • I apologize for perhaps not a clear question, but I asked for the "simplification" (using one view) of the application is already working, I want to simplify it. As far as I understand, to implement a “template view” you need to make a controller in the view model (or connect a controller) that will substitute all the necessary keys (names and values ​​of that form) now with 15 files each * View.xaml and * ViewModel.cs I want to use one View and ViewModel + "controller.cs". ps looked your example. - Neznaika

0