在ShowDialog
始终重置View
并删除TextBox
控制值后。如何防止刷新View
?
注册温莎
public class Installer : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Component.For<IWindowManager>().ImplementedBy<WindowManager>());
container.Register(Component.For<IMyViewModel>().ImplementedBy<MyViewModel>());
}
}
<Window x:Class="MyProject.Views.MyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
Height="200">
<Grid>
<Button x:Name="ShowDialog" Width="70" Content="Show Dialog" />
<TextBox x:Name="textBox" Height="23" Width="120"/>
</Grid>
</Window>
public IWindowManager WindowManager { get; set; }
public IMyViewModel MyViewModel { get; set; }
public void ShowDialog()
{
WindowManager.ShowDialog(MyViewModel);
}