Receive messages for derived types in MVVMLight
- by Hrvoje
Shouldn't this test pass:
[TestMethod]
public void derived_message_subscription()
{
bool handled = false;
Messenger.Default.Register<GenericMessage<baseClass>>(this, true, (msg) => handled = true);
Messenger.Default.Send(new GenericMessage<testClass>(new testClass()));
Assert.IsTrue(handled);
}
public abstract class baseClass { }
public class testClass : baseClass { }
I have to receive all messages for classes that inherits from one base class. MVVMLight has bool property receiveDerivedMessagesToo in Register method, but it seems to me that it isn't working.