Good or bad practice for Dialogs in wpf with MVVM?

前端 未结 3 1707
孤城傲影
孤城傲影 2020-11-22 03:54

I lately had the problem of creating add and edit dialogs for my wpf app.

All I want to do in my code was something like this. (I mostly use viewmodel first approach

3条回答
  •  礼貌的吻别
    2020-11-22 04:41

    I've been using an almost identical approach for several months now, and I'm very happy with it (i.e. I haven't yet felt the urge to rewrite it completely...)

    In my implementation, I use a IDialogViewModel that exposes things such as the title, the standad buttons to show (in order to have a consistent apparence across all dialogs), a RequestClose event, and a few other things to be able to control the window size and behavior

提交回复
热议问题