It is necessary to open a new window with the specified content (it already exists, filling follows the template).
Specifically - in the method I get the name of the window and I need to open a window with the specified name and data inside the window (data can also be obtained by the name of the window).
Window code:
<Window ... Title="{Binding Path=Tittle}" > <Window.DataContext> <vw:TableViewModel/> </Window.DataContext> <Grid Margin="5"> <controls:AttendanceTableControl/> </Grid>
and ViewModel (of this window)
public class TableViewModel : NotificationObject { public string Tittle { get; set; } public StudentGroup CurrentGroup { get; set; } public ObservableCollection<string> Dates { get; set; } public TableViewModel() { } ... }
In this method it is necessary to open the window:
void OpenTableForSelectedGroup(object iEvent, string tabbleName) { if (iEvent is Event) { // ShowTable(tabbleName); // загрузить конкретную группу // для конкретной группы отобразить таблицу } }
Depending on the name of the window, I need to load certain data into Dates
and CurrentGroup
(well, set the Title
window).
Tell me, please, how to correctly organize such using MVVM?