wpf - MVVM Light Send Message from 1 view to another -
i using mvvm light wpf application use messenger feature pass values 1 viewmodel viewmodel.
loginviewmodel.cs
messengerinstance.send<int>(cid); orderviewmodel.cs
messengerinstance.register<int>(this, x => { messagebox.show(x.tostring()); }); the orderviewmodel needs integer when printout value of x, 0. example given, messagebox not seen. skips right on code.
sending:
messenger.default.send<int>(cid); receiving
messenger.default.register<int>( this, <int>(this, x => { messagebox.show(x.tostring()); })); keep in mind registering needs set before message sent. messages not queued. extensive description here.
Comments
Post a Comment