Passing enum value to CaliburnMicro viewmodel via query string
I'm new to Caliburn Micro and I'm experimenting with its WP7 implementation. I'd like to pass the value of an enum from one VM to another but I must be missing something obvious: I tried to pass its name and its numeric value, but the target VM always gets the default value (corresponding to 0).
My scenario in more detail: say I have a VM with a property exposing an enum value. Say the enum is ProductFamily { Hardware, Software }; I have a button which opens another screen with an underlying VM which should show a list of products according to the family chosen. So the VM calls Navigate on the INavigationService instance received in its constructor, like:
_navigation.Navigate("MyView.xaml?Family=" + _nFamily, UriKind.RelativeOrAbsolute);
(this code passes the name, but I tried also with (int)_nFamily). Now, I have a corresponding Family property in the target VM, e.g.
public ProductFamily Family { get { ... } set { ... } }
if I place a breakpoint in the property setter I can see it is called by CM, but the received value corresponds to the defa开发者_开发知识库ult (0, say Hardware in the sample above), while I'm expecting another one. I can confirm the right value is passed when building the query string for navigation. So, how happens that the target VM gets an incorrect value?
Thanks to all
It sounds like this may be a bug in the value conversion logic. Can you create a ticket for the issue on the project site and attach a simple sample that demonstrates the problem? If so, I can probably get this fixed relatively quickly.
精彩评论