My wpf application has a UserControl that host a transition control. The transition control gets it's TransPages loaded in code.
#region Create our singleton that has the default pages
//add our pages...hard coded for now
TransPage tp_MVW =
new
TransPage();
tp_MVW.DisplayName =
"MVW"
;
tp_MVW.PageUri =
"/SSODemo;component/uc_MVW_Host.xaml"
;
TransPage tp_MediT =
new
TransPage();
tp_MediT.DisplayName =
"MediTech"
;
tp_MediT.PageUri =
"/SSODemo;component/uc_TechHost.xaml"
;
TransPage tp_Google =
new
TransPage();
tp_Google.DisplayName =
"Google"
;
tp_Google.PageUri =
"/SSODemo;component/uc_Google_Host.xaml"
;
Props.TransitionMap = TransMap.Single_TransMap;
Props.TransitionMap.Pages.Add(tp_MVW);
Props.TransitionMap.Pages.Add(tp_MediT);
Props.TransitionMap.Pages.Add(tp_Google);
#endregion
and everything works as it should. Now these three user controls, as you can see, are static files in the project with a physical path. All three of the controls have a WPF WebBrowser control. What happens when a user clicks a hyperlink in one of these browsers that opens has target=_blank and a new window opens. Well yes a new window opens OUTSIDE of the WPF application. No worries I added the needed hooks and now intercept that new window opening event. At this point what I want to do is create a new control with a WebBrowser on it and send it to the desired url. THEN I want to add it to the TransPages so it shows in the list of windows to transition between. My question is two fold. What method would you recommend for dynamically generating the user control (I have an idea about using ControlTemplate) and more importantly HOW would I add this "UserControl object" to the PageUri when it is expecting a physical path?
TIA
JB
that host a webbrowser. This loads great and all is well. Next the user clicks on a link and a new browser window opens outside of the wpf app. This makes sense since the wpf browser is just a wrapper and not a true WPF control. So I intercept the new window event and this is where it gets tricky. I want to load the page being opened in a new usercontrol's web browser control. In other words repeat the situation by which my app opens dynamically.
So I thought about creating a "NewWebPage" UserControl template. Great I could use it one time. The next click no more NewWebPage template as it has been used. (well technically I could reuse it but then the current page would be lost) What I would really like to do is use the NewWebPage template as a template. Would a DataTemplate be the way to go for this? If so how exactly as I've not used one in this way before.