different application bar in panorama windows phone for navigation - c#

I am start developing application for Windows Phone 8.
As usual, there is something coming up. yups, that is error. LoL
I have an application using panorama, and I planning to put an appbar for each panorama item which will generate different appbar for different panorama item.
Luckily, I've found a tutorial about it. Here is the link :
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394036(v=vs.105).aspx
My problem is, how can I navigate to other windows phone page (known as xaml) from this App.cs??
Because when I start implement what I've known it bring me an error.
Any help and answer will be appreciated. ^_^
Thank you so much.
Regards,
Budi Prasetyo

"How can I pass a parameter from my mainpage.xaml or mainpage.cs, to app.cs? "
You can create a public property in your App.cs, something like:
public int ItemId {get; set;}
As the App context is available everywhere, you can access it via your MainPage.cs.
App.ItemId = your ID here

Related

Universal App On Phone - How to hide DisplayName?

When I run my Windows Universal App on my Windows 8.1 phone, the LiveTile has additional text (the name of my app) on it that I'm trying to hide. The text seems to be coming from the Package.appxmanifest
<m3:VisualElements DisplayName="This Text Appears" ...
I found a similar question (Is it possible to create a Windows Phone live tile where no title is displayed?) that suggests leaving the value empty. When I do this, Visual Studio complains that it is invalid and I'm not able to compile. Removing the DisplayName entirely also results in an error.
I can see other applications that do not show any text, so it does seem possible.
Can anyone tell me how to hide the DisplayText from my LiveTile, but still have the name of my app appear correctly on the list of installed apps on the phone?
The template I'm using for the live tile (TileWide310x150Image).
The DisplayName attribute inside the Package.appxmanifest file is required and cannot be left blank. It's also the name that will show in the Phone's list of installed Apps. You want that be the proper name of your app.
The name of the app will appear on the LiveTile and, in that context, it's called 'Branding'.
https://msdn.microsoft.com/en-us/library/windows/apps/br212854.aspx
<binding template = tileTemplateNameV2
fallback? = tileTemplateNameV1
lang? = string
baseUri? = anyURI
branding? = "none" | "logo" | "name"
addImageQuery? = boolean
contentId? = string >
It seems to default to 'name', but by setting it to 'none' the text will no longer be displayed on the live tile.
I was able to remove the Wide Tile Display Name in a Windows Phone 8.1 Runtime C# Application with the following code:
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150PeekImage04);
XmlNodeList brandAttribute = squareTileXml.GetElementsByTagName("binding");
((XmlElement)brandAttribute[0]).SetAttribute("branding", "none");
squareTileXml is the name of the XML being configured to the Live Tile while TileWide310x150PeekImage04 is the chosen template.
Basically I specified a tile template (documentation) and I changed the property branding, which is inside the binding in the XML tree, according to this documentation, to none, removing the Display Name.
I'm not sure if this is the right way of configuring that, but at least it worked.

MapRouteFinder.GetDrivingRouteAsync and MapServiceToken in Windows Phone 8.1 XAML

I have a Windows Phone 8.1 XAML app that uses the MapControl to display maps. In the MapControls Loaded event, I set a valid Bing API key
void MyMap_Loaded(object sender, RoutedEventArgs e)
{
MyMap.MapServiceToken = the key
MapService.ServiceToken = the key
}
I know the Bing API key is valid because the watermark in the MapControl is not shown.
From the page with the MapControl I navigate to another Page where in the ViewModel I try to find a driving route:
var driving = await MapRouteFinder.GetDrivingRouteAsync(new Geopoint(new BasicGeoposition
{
Latitude = Latitude,
Longitude = Longitude
}), Detail.GeneralInfo.GpsCoordinates.Position, MapRouteOptimization.Time);
The problem is that driving.Status is always InvaldiCredentials.
Is there something that I am missing?
The documentation says
Note that you have to provide the authentication token in two separate properties in an app that uses both Map services and the Map control.
and I did this.
The Bing API key I use is generated for Basic / Public Windows Phone App. I also tried to generate one for Basic / Public Windows App, no change.
I have a working app that uses this token. I only set it to a Map control in XAML, and then I can use both the Map and the MapService, apparently.
My Maps key token is 22 characters long. The only way to get it is, AFAIK
Make an app
Upload it to the store but do not submit
You app gets associated with a store ID and you will see a map token
THAT is the token you will need
See screenshot. Is that the procedure you followed?
Also, make sure xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps", not the old Bing control. Don't even know if the old control is still available in the Universal Apps btw

How to get page name with webBrowser

Try to code with WPF. Currently I want to implement a simple webBrowser, and now I'm stuck. I want to get name of opened page (Every tab has name according to opened page), but I can't find the solution. In C# I can use this code:
TabControl.SelectedTab.Text = webBrowser.Url.Host.ToString();
But with WPF it doesn't work.
What is solution to find page name with WPF?
Please try like this,
TabControl.SelectedTab.Text = webBrowser1.Url.AbsoluteUri;

Use text box in another page to edit code of a button?

I'm creating a web browser. On the "mainpage" it has a button that takes you to the homepage, i'd like to give the user the option of changing the home page on "page1" (settings). on page1 I have "textBox1"(where the user enter desired homepage) and "button1" (set). Could you help me set this up? Is there a way where doing that action can change the source of webBrowser1?
First I would suggest you to download this Programming Windows Phone 7 ebook and explore it to learn Windows phone programming before asking StackOverflow.
Coming to your question,
Create a Settings class in the project and Add a static string property named something like "HomePageUri". Then in your Page1, add the source uri to that "HomePageUri".
Then in your main page, in the OnNavigatedTo event update the WebBrowser's source or you can bind the WebBrowser's source directly to the "HomePageUri" property
Good luck

MvxHttpImageView binding not updated

I have the following code
<Mvx.MvxHttpImageView xmlns:local="http://schemas.android.com/apk/res/TestServices.Droid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
local:MvxBind="{'ImageUrl':{'Path':'ThumbNail'}}"
Where I am passing an image url to the ThumbNail property. The above code is part of an ItemTemplate which is being passed an ObservableCollection of TestModel objects as below.
public class TestModel
{
public string ThumbNail
{
get;
set;
}
public string Name
{
get;
set;
}
....
}
The Name property is also bound in the above Template to a TextView and it shows up properly as do other string values. The only issue is that the Image does not show up.
I have tried setting the Image Url upfront in the constructor of the ViewModel and it works then. But when I add fetched values to the collection in the Completed event of my web service thats when the Image is not displayed. I have verified the path to the image url in the completed event and it is right. What could be going wrong here. Many thanks
I'm not sure what's going wrong....
But some things to consider experimenting with are:
setting the MvxBindingTrace level to Diagnostic - does the output panel tell you anything interesting?
if you are updating the url dynamically then do you need to fire the property changed event
if you add a textview with its Text bound to the image url, then does this update correctly?
does using wrap_content for both height and width really make sense here? What happens if you fix height and width to 100dp instead?
does the app work if you use known good image URL - eg a URL from http://placekitten.com?
does the app work if you set a default image to a local file (eg a resource or asset) which is shown while the http image is loading?
do the sample apps work for you - eg the bestsellers or twitter samples? If so, then can you see what they do differently?
can you step into the mvx http image source - are the properties and methods being called at all? If they are, then do they look like they are being called correctly or oddly in any way?
Try those suggestions and I suspect you will find a way forwards. Good luck with the debugging.
if these suggestions don't help, please try adding more info, including info on which version of mvvmcross you are using, which version of Android, which phone or emulator, etc.
Got it, I was using backslashes for creating the url by concatenating strings, changing them to forward slashes turned it into a proper link and its working fine now. Thanks a lot for the help Stuart

Categories