This question is locked. New answers and comments are not allowed.
Hi,
I'd like to handle the ShowDialog event in the viewmodel.
What I exactly like to do is to set a default Subject for the Add new appt. dialog window.
Using the mvvmlight pattern, I setup a command in the viewmodel
This is the XAML i tryed to use inside the ScheduleView section (using interaction)
I binded the ShowDialog as command parameter, but of course that's wrong, and is not a Property but an Event.
So, how can I make it work? And after how can I set up a custom default subject binded to another control's property (this property is available on the viewmodel yet)
Thanks
I'd like to handle the ShowDialog event in the viewmodel.
What I exactly like to do is to set a default Subject for the Add new appt. dialog window.
Using the mvvmlight pattern, I setup a command in the viewmodel
Private _addingAppointment As ICommand Public ReadOnly Property AddingAppointmentCommand() As ICommand Get If _addingAppointment Is Nothing Then _addingAppointment = New RelayCommand(Of Object)(AddressOf CommandExecute, AddressOf CanCommandExecute) End If Return _addingAppointment End GetEnd PropertyPrivate Sub CommandExecute(parameter As Object) ' Code here End SubPrivate Function CanCommandExecute(parameter As Object) As Boolean ' Code here Return TrueEnd FunctionThis is the XAML i tryed to use inside the ScheduleView section (using interaction)
<i:Interaction.Triggers> <i:EventTrigger EventName="ShowDialog"> <i:InvokeCommandAction Command="{Binding ViewModel.AddingAppointmentCommand, Source={StaticResource Container}, Mode=OneWay}" CommandParameter="{Binding ShowDialog.ShowDialogEventArgs.DialogViewModel, ElementName=ScheduleView}"/> </i:EventTrigger> </i:Interaction.Triggers>
I binded the ShowDialog as command parameter, but of course that's wrong, and is not a Property but an Event.
So, how can I make it work? And after how can I set up a custom default subject binded to another control's property (this property is available on the viewmodel yet)
Thanks