如何在没有刷新视图的情况下显示ShowDialog

时间:2014-01-13 11:29:52

标签: c# wpf mvvm caliburn.micro showdialog

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);
}

0 个答案:

没有答案