MVVM(Model-View-ViewModel)是一种软件架构模式,用于实现用户界面(UI)和业务逻辑之间的分离。 view 和 model 之间没有直接的关系,通过 viewModel 来完成数据双向绑定。
xaml界面(输入框与StudentViewModel相关属性绑定)
<Control:MetroWindow.Resources>
<Style x:Key="FromLabel" TargetType="{x:Type Label}">
<Setter Property="FontSize" Value="20"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="Margin" Value="5"></Setter>
</Style>
<Style x:Key="FromTextBox" TargetType="{x:Type TextBox}">
<Setter Property="FontSize" Value="20"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="Margin" Value="5"></Setter>
<Setter Property="Width" Value="200"></Setter>
</Style>
</Control:MetroWindow.Resources>
<Grid>
<Grid.R