WP7 Database Support – The Quick and Dirty Intro

I finally got my act together and started doing some WP7 development again. It has been a while, and a few things have happened since I was last doing it…Mango for example. This also means that there are a heap of new features available to me as a developer, but the one that I have got real excited about is actually the database support…

So, Chris, being who you are, why in the world did you chose that feature to get excited about? Well, partly because it was the first new feature I have tried out. But mostly because I sort of didn’t expect to be as neat. Knowing that it was based on SqlCE, I sort of expected it to use a subset of ADO.NET, and regular SQL for access. However, color me surprised when I realized that that wasn’t the case. Instead, it uses Linq-to-SQL and attribute based entity mapping. And on top of that, I didn’t have to create a base database and include it in my project in some obscure way. The database can be created based on the attributes, which is a nice little treat…

More...

Building a template selector in Silverlight

There are several “missing” features in Silverlight that people keep bringing up, or keep trying to find solutions for. One of them is the template selector, or DataTemplateSelector class to be more specific.

The DataTemplateSelector has a single responsibility, which is the way it should be. It is responsible for returning a DataTemplate based an object. Generally, it is used in lists, where the data template can be selected based on the bound item, and thus give different templates to different kind of objects in the list.

In Silverlight, this is not possible out of the box, and instead requires us to create multiple UI controls, and hide and show them using data binding. This approach works, but it easily becomes heavy and complicated, which is why I want a template selector that works…

More...

Is Windows Phone 7.5 Too Good?

I know I am a Microsoft fanboy, and I am the first to admit it. But I still want to say that I can listen to other peoples arguments and try to look at the facts objectively. I tend to see benefits in a lot of Microsoft things, but that doesn’t mean that I believe that everything else sucks.

I have used a Windows Phone device since before they were even released, built a couple of apps for it and talked about it for different audiences. And it is not a big secret that I like it, especially since I got Mango on my phone.

Having that said, I still believe that there are 2 very good alternatives available. The iPhone is, whatever kind of fanboy you are, a great phone. No, I don’t like a lot of things when it comes to Apple, and I don’t like being stuck with iTunes, and I don’t like Apple’s censorship. But it still is a freaking awesome phone, and pretty much single handedly managed to change the smartphone market into what it is today, which is SO much better than it was with Windows Mobile.

More...

Using querystring parameters with the WebBrowserTask on WP7

I have just built a Windows Phone 7 app that is hopefully about to pop up on the marketplace within a couple of days. It is a fairly simple app, with very few impressive features. The most complicated part was to get the SQLite db used by the iPhone version of the app, to work on Windows Phone 7. Unfortunately I did not get SQLite to work on WP7. I ended up transferring the data to XML and adding some index tables, also in XML. But that isn’t the topic for this post.

The reason that I am writing this, is that I got stuck on a little thing while doing. Nothing complicated, but worth noting…

More...

A Windows Phone 7 ComboBox

I am currently finishing off a tiny little WP7 application for a client here in New Zealand, which as such is not that very impressive. It seems like there is a LOT of apps on the way for the phone. I like it! At least the developers seem to have adopted the phone as their newborn child…or at least as a potential platform for future mobile apps…

But I am not going to be writing about that app. At least not right now. Instead, I wanted to write a little about something that surprised me. I have not been doing too much WP7 development. At least not the kind that includes a load of input controls. So I was kind of stumped when I found out that the phone does not have a ComboBox. Or rather, it does, but it doesn’t have a template suitable for the phone.

I found this to be rather odd, but could on the other hand understand that a ComboBox is probably not a control that is very well suited for a device like the phone. The OS itself seems to be using a list picker thingy instead, but that control seem to have stayed in Microsoft’s own control library and is not available. At least not that I have found.

So I guess the only solution is to do it yourself…at least after you Google it, which was what I did. I did find a couple of interesting ideas on how to style it, but they didn’t seem to follow the Metro style well enough to make me happy. Finally I found http://dotnet.dzone.com/articles/metro-style-combobox-windows, which got to act as the foundation for my control…

More...

Zero To Phone Hero - Key points - part 1

I have just come back to Wellington after having spent a week travelling around and speaking at TechEd Australia and TechEd New Zealand...and of course CodeCamp in Auckland before TechEd.

Both TechEds were full of interesting people and interesting sessions. Not that I actually attended that many. But I assume they were interesting…

At both the aussie and kiwi conferences, me and Chris Auld showed off how to build an Azure backed Windows Phone 7 application in 60 minutes. And at both conferences, we promised to put up some blog posts around it. So here is my first one…one that talks about some of the key pieces that were shown. As well as some that weren’t shown…

More...

Phone Zero to Phone Hero in 60 minutes

As some of you might have seen/heard, I am speaking at TechEd New Zealand and TechEd Australia the coming two weeks. This is the reason for my blog being kind of quiet lately, I have just had a bit too much to do.

One of the presentations I am doing, is presented together with Chris Auld and is called "Phone Zero to Phone Hero in 60 minutes". It is a  "double feature presentation" with two projectors, two computers, two presenters and two applications. And at the end of the presentation, the two applications come together to form a Windows Phone 7 application backed by an Azure service.

We have finally got all of it built and up and running, so I thought I would give you a sneak peak of what is to come.

More...

A little warning about the hacked Windows Phone 7 image

I know that I possibly shouldn’t say this, but I downloaded the hacked WP7 emulator image and started using that while developing. Why? Well, I wanted to try out some of the OS integration that wouldn’t be possible with the regular emulator. So I did it…I admit it…

And it is kind of cool to be able to see more of the phone functionality in the emulator…even if I don’t have a touch screen. And to be honest, the interface gets a little clunky compared to the real thing with a touch interface when using a mouse…

But do remember that it is NOT the original image. So even if it looks as though it is just an unlocked version of the original image, it is actually a bit different. I haven’t found a lot of things that are different, but push notifications are unfortunately farked on the hacked version. It doesn’t throw an exception or anything. It just swallows the request for a new channel Uri.

I’m not sure if it is only me, or if it is like this for everyone running the hacked version, but it can be a thing to keep in mind if things aren’t working as they should…

Having that said, I probably should also mention that my computer has issues loading up the original emulator as well. It is VERY slow to start. Or rather, it starts quickly, but it takes ages for VS to deploy to it the first time. I think it might be due to some hardware issues on my machine or something, because I am not seeing the same issue on my office computer.

So I assume that this could possibly have an effect on the hacked emulator…but I haven’t been able to confirm this as I am not using the hacked version at the office…

Windows Phone 7 InputScope in Visual Studio and Blend

Lately I have been working a bit on a couple of Windows Phone 7 apps, and I found a couple of interesting things along the way. I am going to try to blog more frequently soon, and try to cover as much of the interesting stuff as I can find. But it will have to wait until after TechEd New Zealand. But if you happen to be going to TechEd Australia or New Zealand, don’t forget to come to one of my talks and say hi.

Anyhow, the funky problem I am going to write about today is around a feature called InputScopes. On the phone, you can configure your TextBoxes to use different InputScopes. The InputScope defines which of the different software keyboards to use when writing in the TextBox. This is a really cool feature as it helps the user to write the type of info he/she is supposed to provide. It can be things like numbers or currency or chat. Each InputScope results in a different keyboard. Or at least some of them do. There seems to be more InputScopes than cool keyboards at the moment though…

More...

Windows Phone 7 Beta tools installation problem

A wee while back, I installed the new WP7 beta tools on my machine. I then started to rewrite the code for my push notification stuff to use the new beta APIs. And everything went fine until I pressed F5 to try and run it. At that point, it spewed out an exception saying

"Connection failed because of invalid command line arguments"

Apparently, I wasn’t alone to have this problem. A quick Google came up with several forum threads and interesting potential solutions.

The problem only arises if you had the previous phone tools installed and the reason is that he emulator creates a directory to store information in. Unfortunately, this directory isn’t removed when the old tools are removed. The good thing is that removing it fixes the issue. So if you run into the error message above, go to %LocalAppData%/Microsoft/ and delete the Phone Tools directory. Then restart the emulator, and it should be running nicely…