Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit SL3 Frame & Page controls
3 replies. Latest Post by AustinLamb on June 29, 2009.
(0)
CraigMuc...
Member
268 points
131 Posts
06-26-2009 10:39 AM |
I have a Frame control on my main page. I set the Frame's Content property to a Page control. When I am done with my Page, I want to close it and remove it (form within the Page events) from the Frames content. How can I do this?
AustinLamb
602 points
104 Posts
06-26-2009 7:15 PM |
You shouldn't set the Content property on Frame directly - if you do, most/all of the value Frame provides is lost :) Instead, you should either set the Source property to a Uri of the Page to load, or use Frame.Navigate() to navigate to the page.
Beyond that, can you explain a bit more about what you're trying to achieve? Frame/Page may not be the best solution, but without understanding the problem I don't have any other suggestions.
06-27-2009 8:35 AM |
Hi there,
frmContent.Navigate(
...and it loads fine. What I am trying to do is from the page that has just been loaded into the frame, I want to have say a Cancel button which will close the page. In other words, clear the forms source.
06-29-2009 1:51 PM |
You could navigate the Frame somewhere else by calling NavigationService.Navigate(someOtherUri) from within the Page - that will navigate the Frame which is hosting the Page. So you could navigate it to a home page or something to "reset" the Frame.
Another option could be to walk up the visual tree to find the Frame in the tree above the Page and set the Visibility of the Frame to make it "disappear".
But I'm still not sure I understand the scenario - why would a Page want to do this? The problem would be that (for browser-integrated Frames) the user could still hit the back button in the browser and go back to the Page you're trying to "cancel" out of, which I am guessing you don't want based on your description. If that's ok, then my above suggestions should work fine - but if that's not ok, then maybe Frame isn't really what you want to use in this case?