Background the corresponding code:
Public CurriculumsView ()
{
InitializeComponent ();
The viewModel=new MainWindowViewModel ();
}
The front desk corresponding code:
The Header="classification"/& gt;
The Header="content"/& gt;
The type and the content is contained in the mainViewModel CurriculumViewModel entities in the class attribute of Curriculum
CodePudding user response:
Don't you write a listview binding, at the front desk binding & lt; ListView. View itemssource="{Binding viewModel}" & gt;Or binding in the background, now at the front desk of a name for the Listview & lt; ListView. View name="lv" & gt; And then in the background of public CurriculumsView ()
{
InitializeComponent ();
The viewModel=new MainWindowViewModel ();
}
Add lv. Itemssource=viewModel that effect is
{
InitializeComponent ();
The viewModel=new MainWindowViewModel ();
Lv. Itemssource=viewModel
}
Hope to adopt
CodePudding user response:
Sorry, forgot to paste the binding, before I have binding, so you say is not a problem now I don't know, but still thank you,Public CurriculumsView ()
{
InitializeComponent ();
The viewModel=new MainWindowViewModel ();
Enclosing DataContext=viewModel;
}
CodePudding user response:
No great god passing? From the topCodePudding user response:
In the ListView ItemsSource="{Binding}"CodePudding user response:
The ListView. Itemssource you bound