Error window show modal in MVVM WPF

前端 未结 6 2227
半阙折子戏
半阙折子戏 2021-01-02 15:25

I have implemented my MVVM error message as a message dialog that subscribes to error messages via a mediator class, so that other viewmodels can notify it if any errors occ

6条回答
  •  独厮守ぢ
    2021-01-02 15:56

    i'm using the same method as Scott Whitlock.

    there is just one more important property to set:

    class ModalDialog: Window
    {
    }
    
    .
    .
    .
    
    var dlg = new ModalDialog {
        Content = viewModelName,
        **TopMost = true,**
        Parent = mainWindowViewModel
    };
    
    dlg.ShowDialog();
    

提交回复
热议问题