我正在使用mvvm模式创建一个库应用程序。我有bookview,studentview,issueBookview,每个视图都有自己的viewmodel。在每个视图上都有一个按钮(命令),如果用户单击书本按钮,则应显示书本视图,或者如果用户单击学生按钮,则应显示学生视图。我无法获得此问题的正确而简洁的示例。如果有人举一个简单的例子,我将不胜感激。预先感谢。
<Grid x:Name="MainMenu" Grid.Column="1" >
<Label Style="{StaticResource labelStyle}">Menu</Label>
<StackPanel Margin="10, 50,10,50" VerticalAlignment="Top">
<Button Style="{StaticResource buttonStyle}">Issue Book</Button>
<Button Style="{StaticResource buttonStyle}">Return Book</Button>
<Button Style="{StaticResource buttonStyle}">Add new Book</Button>
<Button Command="{Binding CreateCSV}" Style="{StaticResource buttonStyle}">View Book Data</Button>
<Button Style="{StaticResource buttonStyle}">Add new Student</Button>
<Button Style="{StaticResource buttonStyle}">View Student Data</Button>
<Button Style="{StaticResource buttonStyle}">View Issued Books</Button>
<Button Style="{StaticResource buttonStyle}">View Return Books</Button>
</StackPanel>
</Grid>