开发者

How can I parse query string in WPF?

开发者 https://www.devze.com 2023-03-10 08:04 出处:网络
hi I have wpf application. I created a pop up that act as container of pages being called. the pop up has frame in which I just assign source for it to load. My prob is that I need to pass a query so

hi I have wpf application. I created a pop up that act as container of pages being called. the pop up has frame in which I just assign source for it to load. My prob is that I need to pass a query so I can retrieve it upon loading of the called page.

I have looked in google and most of the answers are saying use NavigationService.Navigate.CurrentSource.Query but the prob is Navigation is null when I use it.

activity flow: When btn clicked = it calls window pop up show with some parameters. pop up loads : selects which case to do according to passed param (see below). In the code below I want to pass the value x as query.

My code:

 case PopUpModule.GALContin开发者_如何学PythonuingEduHistory:
                string x = "hello";
                lblHeader.Text = "GAL Continuing Education History";
                frmContent.Source = new Uri ("../Forms/FileMaintenance/Mediator/ContinuingEducHistoryPopUp.xaml?value=x",           UriKind.RelativeOrAbsolute);
                break;

Now my prob is how do I parse it when ContinuingEducHistoryPopUp.xaml loads?

thanks


To use the Navigation framework, you should use:

frmContent.Navigate(new Uri ("../Forms/FileMaintenance/Mediator/ContinuingEducHistoryPopUp.xaml?value=x",           UriKind.RelativeOrAbsolute);

Note: you can also make use of UriMapper to have simpler Uris in code.

0

精彩评论

暂无评论...
验证码 换一张
取 消