Aug 7, 2012 at 10:03 PM
Edited Aug 8, 2012 at 5:05 PM
Hi, This is my first post here as I'm just learning MVVM and Caliburn.Micro. Of the frameworks I've looked at so far this seems to be the best.
I've just gone through the Caliburn Micro Part 4: The Event Aggregator tutorial
and noticed something I am unsure about.
This example include code such as this:
this.events.Publish(new ColorEvent(new SolidColorBrush(Colors.Green)));
He said that in a real app it would probably be better to use a string or other basic value rather than a brush. Does that mean that the messages for events should generally be quite small?
Each time a radio button is selected it generates a new brush and event message. I thought that you could create a static field that stores an instance of the message and reuse this. I tried it out and this works.
So my question is this, is it worth doing this? I know in this example the message is small but could there be cases where it makes sense to have a more complicated message.
I've seen some mention of using weak references in MVVM frameworks to avoid memory leaks, this is why I am wondering about this.