Replacement of NavigationService.Navigate in Universal App - navigationservice

I am working in migration of project from windows phone 8.1 to windows universal app.
windows phone 8.1 NavigationService can be implemented in Universal App with several methods of Navigation like Frame.Navigate(typeof(MainPage)); or Frame.Navigate(typeof(MainPage), param);
But instead of having MainPage as .XAML page, I am building runtime URI in the form of string with querystring appended at end.
The similar API was available in windows phone 8.1
string strpath = "aaaaaaa";
NavigationService.Navigate(new Uri(strPath, UriKind.RelativeOrAbsolute));
But not able to find the replacement of windows phone 8.1 NavigationService.Navigate(new Uri( .. ) ) in Universal App.
Please help .....

There is no replacement for NavigationService APIs out of the box for WinRT platform. The best you can have is use NavigationService provided in MVVM-light framework (use type), or you can build one yourself (supply the url and convert it into type).

Related

Windows UWP Richtexteditor

I have a html string like "From: User Demo ABC TEST ". I need to display this string in a uwp xaml control which will render this in html format.
Sample Attached. Im new to Windows App development.
Suggest me some control with sample code which will fulfill my requirement.
PS: This content is dynamic and might contain any basic html tags.
At first, you can use WebView element with NavigateToStringmethod.
Look this sample for Windows 8.1 App which you can use in UWP.
At second, install Windows App Studio WinRT XAML & UWP Libraries and use HtmlBlock control which convert HTML string into native UWP controls

Windows 10 Mobile - cannot hide status bar (StatusBar doesn't exist in context)

I am trying to hide status bar in my Windows 10 Universal App. In WP 8.1, I was using StatusBar.GetForCurrentView().HideAsync();to hide the status bar, however this won't work in my current project (Monogame, Win10 UAP) - I get "StatusBar not found in the current context" error (yes, I am using Windows.UI.ViewManagement).
Am I doing something wrong, or was this option to remove StatusBar removed? How should I do it in W10M?
Thanks in advance.
The trick is that you have to add a reference to the Microsoft Mobile Extension SDK first.
Then the code is the following:
StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
await statusBar.HideAsync();
The reference can be added by right clicking the universal project. Select "Add reference". In the Reference Manager dialog select "Windows Universal" on the left. Choose "Extensions" and check the "Microsoft Mobile Extension SDK...".
As this is a universal App it will run on every device, but the API will be available only on mobile Devices (aka Phones) with Windows 10. Therefore feature-detect if this API is available at runtime before you actually call the API. Otherwise it will throw a TypeLoadException at runtime.
Use the Windows.Foundation.Metadata.ApiInformation Namespace to find out if the API is available. (E.g. Method IsTypePresent() .
I recommend working with typeof instead of Strings here, e.g. like this:
var isStatusBarPresent = ApiInformation.IsTypePresent(typeof(StatusBar).ToString());
Learn more about adaptive code here: https://channel9.msdn.com/Series/A-Developers-Guide-to-Windows-10/08

Can we perform navigation between Windows Phone Silverlight 8.1 project page and a Windows Phone 8.1 project page under same solution?

I am working in Windows Phone application in which I have two projects one is Windows Phone Silverlight 8.1 and another is Windows Phone 8.1. I want to navigate from a xaml page in Windows Phone Silverlight 8.1 project to Windows Phone 8.1 Project on a button click and then return back to the page. Is there any possible way to do that?
Thanks,
Ekta
Regardless of their types, there is no way to directly navigate to a page in another app on Windows Phone. Your best option is to declare a URI association in the target app that the source app can launch with - see here for details.
As for returning to the source app, you should try to leverage the system back key if at all possible. However, if it's not going to be obvious to the user that she should hit the back key, you have two options:
Use Application.Current.Exit() to close the target app, which will
return the user to the last session in the back stack, which should
be the source app (unless the user task-switched in the interim).
Register a URI association in the source app and navigate back to
that from the target. Note that the process of registering and
handling invocation of URI association activation is different in WP
Silverlight apps - see here.
The difference between the two approaches is that if you Exit, the target app will be terminated and removed from the back stack whereas launching a URI association results in a new forward navigation and will leave the target app in the back stack.

Point to an app in windows phone store

I need to implement a button in my windows phone 7.1 application, that points the user to a "PRO" version of my application in windows phone store.
How can I do that?
In the click event handler of your application, give or navigate to the URI of the pro version of your app:
See here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394017(v=vs.105).aspx
Use the Marketplace detail task to launch the Store or Marketplace and then display the details page for a specified app. If you do not specify the app, the details page for the calling app appears.
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentIdentifier =
"c14e93aa-27d7-df11-a844-00237de2db9e"; // EXAMPLE
marketplaceDetailTask.ContentType =
MarketplaceContentType.Applications;
marketplaceDetailTask.Show();
Source : http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394017(v=vs.105).aspx

Include Windows 8 namespace in Windows Phone 8 [duplicate]

I am trying to write a Windows Phone 8 SDK-based application. I keep seeing mention of a ProgressRing control but I don't see it in the Toolbox or in the xaml designer.
How do I use this?
ProgressRing is part of the Win8 UI controls, not WP8. In WP8 you should use SystemTray.ProgressIndicator instead which is part of the windows phone UI shell. See here and here for samples.
See below blog link for simple copy&paste code to exactly replicate the Windows ProgressRing (uses the actual style code). Works perfectly, just added it to my WP8 project:
http://briandunnington.github.io/progressring-wp8.html
There is more info about adapting it to WP8 in the answer to this question:
How to Use ProgressRing in Windows Phone 8
Download this app for your phone to see it in action.
ProgressRing is not available for Windows Phone 7 or 8, you have to use ProgressBar or rather the PerformanceProgressBar:
http://www.windowsphonegeek.com/articles/WP7-PerformanceProgressBar-in-depth

Resources