Откройте диалог с MVVMC#

Место общения программистов C#
Ответить
Гость
 Откройте диалог с MVVM

Сообщение Гость »


I'm trying to show a dialog window when something throws an error in my application. When the viewmodel wants to launch a dialog, it fires an event and the View's code behind answers by creating a new Dialog window and showing it. The problem that I have is that I cannot pass any info to the dialog (like the error message), because the DialogViewModel isn't loaded when I create the DialogView.

I tried this on the DialogView constructor:

public DialogView() { InitializeComponent(); var vm = (DialogViewModel)DataContext; if( vm != null ) { vm.ErrorInfo= "Sample error message"; } } but this doesn't work because the DialogViewModel is null.


Источник: https://stackoverflow.com/questions/781 ... -with-mvvm
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»