navigateuri

C# Hyperlink in TextBlock: nothing happens when I click on it

强颜欢笑 提交于 2019-12-23 06:50:34
问题 In my C# standalone application, I want to let users click on a link that would launch their favorite browser. System.Windows.Controls.TextBlock text = new TextBlock(); Run run = new Run("Link Text"); Hyperlink link = new Hyperlink(run); link.NavigateUri = new Uri("http://w3.org"); text.Inlines.Add(link); The link is displayed correctly. When I move the mouse over it, the link becomes red. PROBLEM: When I click it, nothing happens. Did I forget something? Do I need to implement some kind of

Passing parameters to a WPF Page via its Uri

时光毁灭记忆、已成空白 提交于 2019-12-21 07:55:21
问题 In the context of a navigation-style WPF application (NavigationWindow, not XBAP): Is it possible for a Hyperlink's NavigateUri to contain extra parameters, like path data or a querystring? E.g., is there some way I could set my NavigateUri to /Product.xaml/123 or /Product.xaml?id=123 , and have my Product.xaml page be able to see that it was called with a parameter of 123 ? 回答1: You can do this. See http://www.paulstovell.com/wpf-navigation: Although it's not obvious, you can pass query

Windows Phone 8.1 navigate using string instead of a type

穿精又带淫゛_ 提交于 2019-12-11 19:57:11
问题 In Windows Phone 8.1 there is any way to navigate from one page to another using an string instead of a Type? There is no reflection and Frame.Navigate only accepts type. Thank you. 回答1: I agree with Kai Brummund. You should write a NavigationService. A good example of a navigation service is the MVVM light navigation service. Here you can find the source code. 回答2: Or... you just can use MVVMLight which comes with an integrated NavigationService (INavigationService). You set it in

Windows Phone app calls MapUri() twice when I call NavigateService.Navigate()

一个人想着一个人 提交于 2019-12-07 06:13:55
问题 I recently added a custom UriMapper for saving files into my applications isolated storage when opening them from IE. The code for this looks like this: class AssociationUriMapper : UriMapperBase { public override Uri MapUri(Uri uri) { var tempUri = uri.ToString(); if (tempUri.Contains("/FileTypeAssociation")) { int fileIdIndex = tempUri.IndexOf("fileToken=") + 10; string fileId = tempUri.Substring(fileIdIndex); SaveFileToIsolatedStorage(fileId); return new Uri("/MainPage.xaml", UriKind

Windows Phone app calls MapUri() twice when I call NavigateService.Navigate()

拟墨画扇 提交于 2019-12-05 08:54:53
I recently added a custom UriMapper for saving files into my applications isolated storage when opening them from IE. The code for this looks like this: class AssociationUriMapper : UriMapperBase { public override Uri MapUri(Uri uri) { var tempUri = uri.ToString(); if (tempUri.Contains("/FileTypeAssociation")) { int fileIdIndex = tempUri.IndexOf("fileToken=") + 10; string fileId = tempUri.Substring(fileIdIndex); SaveFileToIsolatedStorage(fileId); return new Uri("/MainPage.xaml", UriKind.Relative); } return uri; } } In InitializePhoneApplication() I do a RootFrame.UriMapper = new