登录成功窗体切换
1、xaml
点击事件将登录页面某个控件带回至ViewModel
<Button Content="登 录" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=pb_password}" Margin="30,10" Width="286" Height="40" Style="{StaticResource ButtonPrimary}"/>
2、viewmodel
-
/// <summary>
-
/// 登录事件
-
/// </summary>
-
public RelayCommand<System.Windows.Controls.PasswordBox> LoginCommand =>
-
new Lazy<RelayCommand<System.Windows.Controls.PasswordBox>>(() =>
-
new RelayCommand<System.Windows.Controls.PasswordBox>(Login)).Value;
-
private void Login(System.Windows.Controls.PasswordBox password)
-
{
-
WIndex window = new WIndex();
-
window.Show();
-
-
Window.GetWindow(password).Close();
-
}