Hello I am currently migrating a C# WPF project to Silverlight and I stumbled on a problem also related to my lack of Silverlight knowledge:
I have my MainPage.xaml which accepts several V开发者_如何学编程iews, for example
I want to pass a String from View1 to View2 programatically. Depending on the value that is passed from View1 , View2 will change. I don't know how to access/transmit values between views(or atleast a workaround - back to parent, and then to the other child? )
I have researched this topic for some time now, but I couldn't figure it out. If my question allready has an answer somewhere on forum || my question is poorly written || my question is stupid || other cases , I am deeply sorry - don't want to irritate/offend anyone.
Thank you.
Ok by view, you mean navigation pages.
Using navigation application, there is many ways to do that but I think the best way is using url parameters (just as html parameters) if your parameters are simple string values, then you can retrieve the value from code using
this.NavigationContext.QueryString["ProductId"];
for more details check here : http://msdn.microsoft.com/en-us/library/cc838245(VS.95).aspx#Y3804
If you need to pass complex types, use a public property in your view.
精彩评论