WP7
WP7
If you’re developing a Windows Phone 7 application you might run into this nasty error when trying to run your application: System.Windows.Markup.XamlParseException occurred Message= [Line: 0 Position: 0] LineNumber=0 LinePosition=0 StackTrace: at MS.Internal.XcpImports.CheckHResult(UInt32 hr)… The cause here isn't obvious from the exception, but actually its very simple once you know what to look for. In my case a basic cut-n-paste error caused bad binding code to get written: Bad code <Image Source="{Binding RelativeSource=ImageUri}" Grid.Column="0" />...
Today I had to write some code that would detect the Emulator we use to test WP7 Silverlight applications. For some reason though I had a really hard time finding the answer. Therefore I decided to post the solution here and to link the thread I finally did find which helped me find figure it out, which is this thread here. Solution: string DeviceTypeDetected = string.Empty;
switch (Microsoft.Devices.Environment.DeviceType)
{
case Microsoft.Devices.DeviceType.Device:
DeviceTypeDetected = "Real Device Detected!";
break;
case Microsoft.Devices.DeviceType.Emulator:
...