Visually Located


Why do you not have Telerik's Phone controls for yours Windows Phone dev?

If you are doing Windows Phone development and you do NOT have Telerik’s Windows Phone control toolkit you are doing something wrong. For the price of a Windows Phone Store developer account (when not discounted) you can join Nokia’s Premium Developer Program. I have been in the program for almost a year and I’ll be renewing my subscription. The Premium Developer Program gives you the following: A Windows Phone Dev Center  account (normally priced at $99, currently $19). You get a token for one year of membership to the dev center. This token can be used at any time. If you already have an account, you can use the token when the account expires. A free license for Telerik RadControls for Windows Phone. These controls and tools are priced at $99 per year (if you wish to receive updates). I have found this toolset to be very valuable. I have only used a few of the components, but it has well passed the $99 value. 12 months of access to This cloud so... [More]

My first days with Xamarin iOS

I recently started a project in which I wanted to create an iOS app using Xamarin. This project will require me to create a binding to a third party iOS SDK, overcome a complex corporate network and prove to myself that Xmarin is a stable platform for development. I’ve only just begun this adventure, and I have already had a fare share of roadblocks to overcome. Here is a short description of the adventure that I chose. I was very fortunate to talk with Xamarin while at the Microsoft Build conference in June. I was invited to a private dinner and was able to speak with Anuj Bhatia, Erik Polzin, and Xamarin’s own CEO and cofounder, Nat Friedman. Every one of them had heard of Schneider Electric and were excited to hear about how Xamarin could help us out. I’m glad that I also had Daniel Rouleau along with me as he has been helping lead up the development effort of our latest mobile platform. I’ve done a bit of research on Mono/Xamarin before. I attended a Mono meetup at last years (20... [More]

Create a consistent background for your Panorama Title

I was helping out a fellow Windows Phone developer with some app testing today and noticed that his app had a Panorama control with a background color that had a break between the last page and the first page. Here’s an example using the “Windows Phone Panorama App” project template.                This looks very weird and is distracting from the real content. This problem is very similar to the Changing the background color of your pivot headers post I did. You cannot just change the background within the TitleTemplate. The above images were created by modifying the TitleTemplate of the Panorama. <controls:Panorama.TitleTemplate> <DataTemplate> <Border Background="Blue"> <TextBlock Text="{Binding}" Width="800" FontSize="80" Margin="0,75,0,0"/> ... [More]

Remove ads with an in app purchase across your entire app

Today I read that the Windows Phone team had added some new samples. I was excited to take a look at the Free App With Paid Products sample to see if they had done anything different than I had in Disney Expedition. When looking at the sample I was even more excited to see this in MainPage.xaml.cs // Each in-app product is identified by a string that is unique for the owning app. This value // is an example identifier for a product that causes the display of ads to be removed from the app. private const string PRODUCTID = "AdRemovalProductIdentifier"; This little snippet was exactly what I was doing! Using the In App Purchase(IAP) model to remove ads from my app. I continued to look at the sample only to become disappointed that the sample did not really show how to remove ads with an In App Purchase. Okay, I wasn’t that disappointed. Removing an ad on a single page once the purchase is made is easy enough to do if you follow the sample. But the... [More]

Using the Geolocator API in your Phone 8 AND Phone 7 apps!

If you’ve done any work with location in Windows Phone you probably know that the a new location API was added at Windows Phone 8. If you want to upgrade your app to take advantage of functionality in Window Phone 8 you have a few options. Continue to use the original GeoCoordinateWatcher API from Windows Phone 7 in your Phone 8 and Phone 7 app Upgrade your app to Windows Phone 8 and use the new API in your Phone 8 app, while the Phone 7 app uses the original API. Upgrade your app to Windows Phone 8 and use the new API in your Phone 8 app AND your Phone 7 app! These options assume you want to continue to support Windows Phone 7. Please do not forget that there are a lot of people with a Phone 7. If you want to do options one or two you can stop reading now. If you want to do option three then you are in the right place. I’m not a big fan of supporting two different APIs in my apps and I don’t like using “out dated” APIs either. What we will need to do is create an A... [More]

Avoid InvalidOperationException when navigating in your Windows Phone apps

I have no idea how I get this error, but in every app I’ve published I get error reports in which navigation fails and throws an InvalidOperationException. The entire stack trace is similar to System.InvalidOperationException Navigation is not allowed when the task is not in the foreground.    at System.Windows.Navigation.NavigationService.Navigate(Uri source)    at MyWPApp.MainPage.OnListBoxItemSelected(Object sender, SelectionChangedEventArgs e)    at System.Windows.Controls.Primitives.Selector.OnSelectionChanged(SelectionChangedEventArgs e)    at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List`1 unselectedItems, List`1 selectedItems)    at System.Windows.Controls.Primitives.Selector.SelectionChanger.End()    at System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(Int32 oldIndex, Int32 newIndex)    at System.Windows.Contro... [More]

Performing an async operation in the OnBackKeyPress method and still exit your Windows Phone apps

The OnBackKeyPress method allows you to perform special logic when the user presses the phone back button. You usually override this method when you do not want the user to actually go back a page. An example of this is if you show a popup, when the user presses the back button you should close the popup. protected override void OnBackKeyPress(CancelEventArgs e) { base.OnBackKeyPress(e);   if (PopupIsOpen()) { e.Cancel = true; ClosePopup(); } } This workflow works great because everything is synchronous. You may have seen some apps that prompt you with a MessageBox asking if you want to exit. If you say yes the app exits and if you say no, you do not exit the app. protected override void OnBackKeyPress(CancelEventArgs e) { base.OnBackKeyPress(e); var result = MessageBox.Show( "Are... [More]

Making the Windows Phone Toolkit CustomMessageBox async

The Windows Phone Toolkit has a nice CustomMessageBox control that allows you to customize the button text of a MessageBox. This message box is nice but you must subscribe to an event for when it is closed. Microsoft.Phone.Controls.CustomMessageBox msgBox = new CustomMessageBox(); msgBox.RightButtonContent = "cancel"; msgBox.LeftButtonContent = "delete"; msgBox.Caption = "Are you sure you want to delete?"; msgBox.Title = "Delete message?"; msgBox.Dismissed += (o, eventArgs) => { // Do some logic in here. }; msgBox.Show(); This requires that your logic for user input to be either in a separate method or above the Show method like in my example. If the CustomMessageBox had a way to show it asynchronously, you could have your logic in one place. Luckily this is very easy with an extension method. public static class Toolk... [More]

Making the Windows Phone Toolkit ListPicker ItemsPanel display a WrapPanel

There are many things that should be part of the Windows Phone SDK and the ListPicker is one of them. There are so many aspects of the phone that use a control that the ListPicker was based on. One of these is the accent color picker. In Phone 7 the phone would display a vertical list of colors with the name of the colors next to it. In Phone 8 they changed this experience and went with a WrapPanel. If you want to to get this same experience, you’ll want to use the ListPicker from the Windows Phone Toolkit. The ListPicker will first display what appears to be a ComboBox, yet when you tap this ‘ComboBox’ it opens up and takes over the entire phone. This is all pretty standard and the ListPicker covers this perfectly. Where it fails us is when we want to change how the ListPicker stacks it’s items. This is generally done by changing the ItemsPanel of an ItemsControl. Unfortunately the ListPicker does not allow you to change the ItemsPanel. If you download or br... [More]

Using the WebAPI to send errors for your apps

If your app does anything at all complex, it’s going to crash. You’re going to miss checking something for null. You’re going to use a resource that doesn’t exist. Your app is going to crash. Luckily there are some ways to make sure you know what’s happening. Little Watson by Andy Pennell shows us a great way to send application errors but requires the user to email them to you. Bjorn Kuiper extended Little Watson by removing the need to email the report and instead send it to a PHP endpoint. This is a great solution provided your server is setup to run PHP . If you don’twant to use PHP, don’t want to install PHP or if you are using a hosting service that does not run PHP then you’re out of luck. Instead of convincing your web provider to install PHP you could create a WCF service, but that seems like a lot of overhead. You could also create an ASP.NET web page and put the error details into a query parameter, but that seems hokie. Luckily the Web API has been introduced. The Web API... [More]