Sunday, April 27, 2014

I recently upgraded to Windows Phone 8.1 Developer Preview.

I love it! This is the best WP release to date. There is one problem I’ve run into that has been driving me nuts for the past few days. I finally found a fix for it, so I thought I would share it.
A lot of people are experiencing this issue. After upgrading, I was getting an error every time I tried to surf the web on my phone. The strange thing was that I was still connected to the internet. All my apps got their data (email, facebook, etc), but whenever I used the browser, I would get an error.

After a lot of searching, I found the solution here:

The basic steps are:
1)Go to settings> Access Point
2)Write down all the settings from your current access point (tap and hold acces point and choose view to see settings)
3)Go back and create a new access point
4)Copy all the original access point settings to your new access point, but leave the proxy and port fields blank
5)Set your new access point as the active access point.
6)Start surfing the web!

I just got this working on my phone, and so far, so good. Only time will tell if the solution sticks, but from what I’m seeing out there… it works.

I hope this helps!

Tuesday, March 11, 2014

Windows Phone–Removing Duplicate Songs and/or Albums

Time for another post that has nothing to do with development…

If you own a Windows Phone, you have probably seen duplicate songs or albums in your music library. This can be a very frustrating bug to deal with and it is difficult to fix. It would be nice if you could simple select a track or album and delete it right from your phone. Unfortunately, Microsoft does not allow us to do that. It would even be great if connecting the phone to your computer and deleting it files in the file browser or via the Windows Phone app would take care of it for you. Well… no. That doesn’t always work. After struggling with this for a little while, I found a solution that worked for me. Hopefully it works for you too if you are in the same boat. Here is what I did to remove the duplicate songs.

-Connect the phone to your computer with the usb cable and open it up in Windows Explorer.

-Locate the Music folder.

-Select View > Show Hidden Files (from the toolbar or ribbon control depending on what os you are running)

-Once you are seeing the hidden files, you should see an Artists folder that contains a file for each artist in your collection. Find the artist that has the duplicate files and erase that file.

-Navigate to that artist’s corresponding music files directory on your phone and delete those files.

-Copy the music files from your music library on your pc back onto your phone. This should re-generate that file you previously deleted under the hidden Artists directory. This is the file that tells your phone what files to display.

That should do it. You can now disconnect your phone and see no more duplicate files (or at least that worked for me).

Good luck!

Friday, March 7, 2014

OutOfRangeInput Error in Azure

I’m fairly new to Azure programming. Maybe this is obvious to everyone out there, but it wasn’t obvious to me, so I figured I’d record it on my blog for all you newbies out there like me.

I have been working on a simple application that stores data in a table in Azure. Because I am new to Azure table storage, I followed a few online tutorials to get started. Here is one of the ones I read.

I made a few basic changes to my code rather than copying it word for word. When I tried to run my app, I kept getting a

StorageException - The remote server returned an error: (400) Bad Request.

every time I tried to insert a new row in the table. The samples were so simple and I thought I followed them closely. I spent a couple of hours trying to figure out what was going on, and I finally stumbled upon the answer. This took WAY TOO MUCH time to figure out, so I hope this helps you out in your development.

So here is the deal…

When I created my entity that I was going to insert, I had a DateTime.Now.ToString as part of the row key in the entity. It turns out you can’t use that in partition keys or row keys. When you are running on Azure, the format for the date is “YYYY/MM/DD”. The ‘/’ character is not permitted in row keys or partition keys.

Once I removed that, everything worked smoothly.

It was a simple error, but like I said before, it took way too long to figure out.

Happy Coding Folks!

Wednesday, July 10, 2013

WPF–SoundPlayer Bug

Here is an interesting one. I was using the SoundPlayerAction in WPF to plan a small .wav file when a view was loaded, and I noticed that sometimes I would get a very strange screeching sound while the audio was playing. This did not happen all the time, but it happened enough that it needed to be fixed. The bug was more apparent on certain machines than others. After some digging around, I found out it had to do with the Garbage Collector of all things.  Essentially, the GC automatically decides to start moving the bytes used in the sound file before it’s done playing the file. This causes the annoying screeching sound. So how did I fix this issue? The solution that worked for me was to simply change the build action on my sound files from resource to content. I then had to change all my references to my audio files to use the correct format (from pack://application to pack://siteoforigin) and that took care of the issue. This bug only presents itself when trying to play audio from embedded resources. If playing directly from a file, you should not have the same problem.

Here are the links I found explaining more about the bug and how to get around it.

Happy Screech-Free Coding!

Wednesday, June 5, 2013

Keeping the Selection Color in a WPF Listbox When it Loses Focus


There are a lot of blog posts out there telling you to change the the ControlBrush resource of a listbox in order to maintain the selection color when the listbox item loses focus. This does not work.

If you want to set the color of the background when an item is selected, you need to change the HighlightBrush. If you want that color to persist even after the item loses focus, you need to change the InactiveSelectionHighlightBrush.

Hope this helps. Happy Coding!


SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"

Wednesday, May 29, 2013

WPF Effects and Blurry Fonts

I recently ran into a very strange bug that took me a while to figure out. I noticed that several buttons in my UI had blurry text. I thought I may have mistakenly changed the opacity or had some semi-transparent gradient overlaying the font that made it look so blurry. That did not turn out to be the case. After digging around a bit I found out what was causing the problem. It turns out that the problem was in my control template. I defined the button to have a border which contains a label inside it’s content. I applied the drop shadow to the outer border and was surprised to find that applying that effect to the border caused the contents of the border to become blurry. After a little research I found that using an effect causes the elements and all the sub-elements inside the control to be rendered into a Bitmap. When this happens, WPF cannot use ClearType rendering to display the text. This causes it to look blurrier than if there is not effect applied.

Here is what my buttons looked like with the drop shadow


And here is the same button without the drop shadow


To get around this bug simply place the text outside of the control that you will be applying the effect to.

     <TextBlock Text=”Blurry Text”/>

//Change the code above to this.


     <TextBlock Text=”Clear Text”/>

If you run into this issue, just change your code like what I did above and you should have clear text on your buttons even if you are using effects.

Happy Coding.

Tuesday, April 16, 2013

Using Animated Gifs with WPF

Ever wish you could use an animated gif in your WPF application? Well, here is an easy way to do so. Simply use the WpfAnimatedGif Nuget package available on codeplex. With that library, you can easily display animated GIFs in your application via XAML or code.

Here is what the markup looks like…


<Image a:ImageBehavior.AnimatedSource="Images/myImage.gif"/>

Head over to for more info.

Happy Coding!