Windows Phone FAQ
April CTP Refresh
I’m trying to install the April refresh of the files and the uninstaller for the win phone dev tools changes into an installer when I click uninstall.
The recommended solution for this type of problem is to let the installer re-install the components it reports are missing, then re-run the installer and choose to uninstall.
If you are still sruck after that, try this tool
by Aaron Steblener.
A deploy that launches the emulator works. Subsequent deploys give Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) every time unless I kill the emulator
This is a known issue we are investigating. Only two knwon workarounds are: restart emulator or change the the GUID in WMAppManifest so it installs multiple versions.
I am getting a first chance exception of type 'System.IO.FileLoadException' in mscorlib.dll when I try to debug my app
There is a known bug when using signed assemblies (e.g. odata, syndication, controls toolkit, bing maps, or any other signed assembly. Check
for the workaround
How can I restart or shutdown my application programmatically
There is no API to do this. Hitting ‘back’ when there is only one page left on the stack is the way to exit the application. Hitting Start button does not exit, just pauses it
How can I detect if my application is exiting so I can
You can listen to Application.Exit, but this might be too late most of the time. You should listen for the Pause event and save your state there.
How can I pin my app on the emulator.
You simply run the application once to deploy it, and then browse to the application list, and click and hold the application icon, you will then get a context menu with the option to pin.
Choosers and Launchers
The MarketPlace Launcher's overloads for Show has parameters, what are these?
I assume you are asking about the Context
- In case of Open operation, there is no context.
- In case of Search operation, it is the search Term
- In case of Review operation, no need to pass context. It defaults to the current application’s product id
- In case of Details operation, if you pass null it means current product id, else you can pass some other product id
Can I control the WebBrowser control's zooom?
No. There is no programatic way to zoom the control. You should include a viewport meta tag to set the initial scale level.
Will TextTrimming property be available on TextBlock?
No. You have to hack it up with your own measure.
I am hitting System.InvalidOperationException in the Navigate method of the WebBrowserControl. What gives?
Don't call the navigate method from your PhoneApplication Page's constructor. you should wait until control is loaded before you Navigate.
Will Microsoft ship a panorama control with the run-time.
We are still investigating. We would love to do it, but are constrained on time. Stay tuned.
I am getting too many MouseLeaves on my custom control.
As far as the emulator is concerned, there is no mouse; everything comes in as a touch event and when the “finger” comes up, the mouse has left the scene, since there’s no reasonable location for it to be at.
Is it temporary that the control styles are included in App.xaml?
Yes. In the final product a master 'generic.xaml' will be injected into your application. This injected dictionary will be based on the theme selected when your app is started.
Dictionary is injected every time your app starts.
I see applications using listbox that show scrollbar only on while scrolling. How can I detect that I am scrolling
Microsoft hopes the templates in a future build will have this Scrolling and NotScrolling VisualStates.
How can I dismiss the SIP programmatically?
Set the Focus() to some other UIElement that is focusable
How can I create a deepzoom image for my Windows Phone project?
Layout, Orientation, and Navigation
How can I detect the resolution of my device
(App.Current.RootVisual as FrameworkElement).ActualHeight and (App.Current.RootVisual as FrameworkElement).ActualWidth gives you device's resolution
If you want to know the visible size (taking AppBar / SystemTray into account) then just ask for it off the page instead.
What happened to TopLevelNavigationService, it is not there on April CTP Refresh
It has been removed. You can access the navigation service from any of your current page instances or, use the Navigate method on PhoneApplicationFrame (your RootVisual).
Can't find PhoneApplicationPage.FullScreen in April CTP
SystemTray is an attachable property now. You can use it in your page xaml, something like:
Imaging, Photo Gallery and video
How can I save my Silverlight UIElements into an image
In a later preview, before RTT, WriteableBitmap will have a method to save as JPEG
How can I save my screen from an XNA app
Texture2D has a SaveAsJpeg method and a SaveAsPng method. Be aware that Zune does not sync pngs, so saveasjpeg is recommended
In April's CTP, you could try:
MediaLibrary library = new MediaLibrary();
library.SavePicture(“My Picture”, streamToJpegData);
// You can use this from inside a Silverlight app provided you have the ID_CAP_MEDIALIB capability.
// You do have to make sure the Stream you pass in contains JPEG file data, but otherwise it should work for you.
How can I get to the geolocation data on a picture
For v1, we don't have an API to do this
What are the supported codecs for video
Supported Codecs and container formats are listed in MSDN documentation:
The Device Emulator does not have hardware decoders so the codec support on the device emulator is much less than what is listed. For Emulator you only have WMA, WMV, and VC1 software decoders.
What are the differences between video on the desktop and the phone?
Check this write-up on MSDN
I looked through the MediaLibrary class in XNA, and it looks like we can only enumerate through audio, but not video content in the media library.
That is correct – you can enumerate audio and photos but not video.
Tried two separate web cams in the emulator and both give COM errors, any clue on getting this to work?
Camera is not supported on the emulator
Is .bmp format supported?
No. Only jpg and png are supported.
How can I play my video in IsolatedStorage using MediaElement?
For April CTP and earlier builds there is a bug that will prevent you from doing it. Stay tuned for later build. Interim you can play media from network or from your content in the app.
Can I play two MediaElements at once
No. To ensure high quality playback we limit it to one at a time
My images look different when synced to the device and read programmaticaly. do decoders change these?
No. decoders and apps show them as they are. Zune software does resize them when syncing them, that might be the cause for your differences
How does volume work between apps and hardware buttons on the device.
Applications get to control the volume for their streams but the hardkeys control the final master output level.
Where is HttpUtility class, since there is no System.Windows.Browser namespace?
HttpUtility is in System.Net namespace
You can also find alternatives for escaping strings at Uri.EscapeDataString and Uri.unescapeDataString ..
Can I open sockets in windows phone?
Not for this v1 release.
My site is down, and async calls are taking too long to timeout. How can I set a reasonable timeout.
Per MSDN docs
, you should call Abort() on your request when you feel iti s appropriate timeout
Are there APIs to read RSS/ATOM feeds?
You could use System.ServiceModel.Syndication from the desktop since it dependencies are entirely present in CF
Can I write multi-player games using wi-fi or blue tooth in the device.
Not in this v1 release.
How can I sniff network traffic from the emulator
Netmon 3.4 (beta) defintitely works. Fiddler works too. If using fiddler, remember to switch it to either trap “non-browser” or “all” traffic and start fiddler before launching the emulator.
Is WCF supported in Windows Phone?
WCF is supported on WP7. When you look at the SL3 version of WCF, WP7 supports that except for the following:
- PollingDuplex support
- Runtime code generation support for ChannelFactory.CreateChannel APIs
- Astoria/Azure support
Is asp.net forms authentication supported
Yes, it should work.
Does the web browser control share the IE cache
No. Each app has its own wininet cache. The webbrowser control instances in your app will use that app’s cache. The IE cache will be separate
How can I identify a device or a user.
Use Microsoft.Phone.Info.UserExtendedProperties.GetValue(“ANID”) in Microsoft.Phone.Info.dll.
This is not in the MIX build.
How unique is this Id? It identifies the user; so you could have a user with two phones. This is persisted across reboots, but not across factory reset (unless you reconfigure for same user).
is there a way to detect if application is idle?
No. You have to do that yourself. yourself (you could subscribe to ManipulationStarted on the root frame with handled=true and then use a simple timer).
Is there any internal page notification that it receives to detect a phone call
Not in v1.
Where is XmlDocument class?
Instead of XmlDocument, use XDocument from System.Xml.Linq.dll
Can I intercept the search button to do an app specific search?
Not in v1.
On April CTP refresh, Splashscreen appears for 3 seconds and disappears (even if my page is not fully loaded)
This is a known issue in April CTP. Should be fixed in later builds
I am trying to receive toast notifications in emulator app. I got everything setup but notification does not show up in emulator at all.
Make sure you have a product / publisher name set in the manifest.
Open WindowsPhonepmanifest.xml, under Properties. Edit Publisher="" to Publisher="something". Redeploy.
Security and Credentials
How can I access the LiveId credentials a user has entered into the device?
In this release, the credentials are not available to third party apps. You will need to prompt the user for credentials and manage these within your app.
is SecureString supported in windows phone
No. Securestring is not in Silverlight.
Serialization and Storage (IsolatedStorage)
How can I deserialize JSON from a rest call
Use DataContractJsonSerializer. it is in System.Servicemodel.Web
How do I manage my Isolated Storage quota
You don't have to. There is no limit
What happens to my IsolatedStorage when app is uninstalled?
It gets deleted. Content saved to media libary is not deleted on Uninstall
Where is the best recommended place to store both static and user-specified configuration information?
You can use the IsolatedStorageSettings.ApplicationSettings.
Is there an API for retrieving information on the files located in the store? I am looking to check when it was last written
In my code the method marked by [OnDeserialized] is never called after deserialization. Is this a known issue?
The following conditions should be met for a valid OnDeserialized callback.
- 1. The accessibility of the method should be public. It can also be internal with InternalsVisibleTo provided to the System.Runtime.Serialization assembly.
- 2. Return type should be void.
- 3. There should be exactly one parameter which should be of the type StreamingContext.
- 4. There should be only one of the four callbacks provided on the method.
If any of the above condition is not met OnDeserialized Attribute will not be called and you would also get an InvalidDataContractException
Tools (Blend, VS, and Emulator)
What is the best way to detect that I am in design-mode in Expression Blend or Visual Studio?
Is there a way to know if my code is running on emulator or device
In the emulator, NetworkInterface.GetIsNetworkAvailable() always return false.
This is a known bug in MIX CTP and April refresh. Sorry! It will be addressed in next build
I’ve lost one of the application templates in Visual Studio 2010. It’s available in the file system but not in Visual Studio… Any ideas?
Try running Devenv /setup.
Running devenv /installvstemplate might also work; but that is going to slow down overall VS performance. The /installvstemplate is a development only option that makes it easy for developer to test their templates. This shouldn’t be used on end user machines. Devenv /setup does a lot of more processing and caching to speed up VS performance.
Is it possible to run two instances of emulator on the same machine. I am doing some networking app and need two emulators to test it.
You can not launch two instances from the Phone tools. You can launch a second instance from command line.
c:\Program Files (x86)\Microsoft XDE\1.0\XDE.exe" "C:\Program Files (x86)\Microsoft SDKs\WindowsPhone\v7.0\Emulation\Images\WM70C1.bin"
Have a very simple application that uses the APplicationBar. The app bar shows one menu item when in portrait. However as the second image shows the app bar displays now items in landscape mode. Is that by design or a bug?
Yes, it’s a known problem in the emulator on machines that don’t support the hardware accelerated graphics in the emulator. It works properly on devices and machines that do
Are there canned MVVM "Data Behaviors" planned for WP7?
Not at this time. The behaviors have dependencies in Silverlight 4.
Is it possible to use Custom Pixel Shader in XNA?
From Shawn Hargreaves blog
For this release, there are no programmable shaders:
“Instead of programmable shaders, we augmented the existing BasicEffect with four new configurable effects: SkinnedEffect, EnvironmentMapEffect, DualTextureEffect, and AlphaTestEffect. These are designed to run efficiently on the mobile GPU hardware, and I think do a good job of providing enough flexibility for developers to create awesome looking games, while also meeting our goals of being able to ship a robust and well tested product on schedule.”
When I deployed my XNA app to the xDE, the orientation is in portrait mode, but when I deploy it to a device, it’s in landscape mode.
The XNA Framework defaults to landscape mode for Windows Phone games, but XDE doesn’t yet support XNA in landscape mode, so portrait mode is the only option there for now. You can set your orientation preferences by using GraphicsDeviceManager settings (SupportedOrientations, PreferredBackBufferHeight, PreferredBackBufferWidth, etc.
Starting with April CTP Refresh, I can compile and debug my XNA game, but it does not show up in list of applications when I am not launching it on the debugger
The games are installed in games hub, which you can't see in the currently slimmed image. Change the Genre attribute in the App element in WindowsPhoneManifest.xml from App.Games to NormalApp
<App xmlns="" ... RuntimeType="XNA" Version="126.96.36.199"
How can I show the SIP keyboard in my xna app
This is not in the CTP, but will be in later builds: Guide.BeginShowKeyboardInput
I am trying to detect if an external headset is attached to the phone,can I use Microsoft.Xna.Framework.Audio.Microphone.IsHeadset
No. this property is true all the time for the phone
About this FAQ
How can I contribute to this FAQ?
We don't yet have this automated. Email us
and we can discuss.
If you just need a few questions/answers added, email those directly.
Where are the other Windows Phone FAQs