ApplicationBar – not your usual control
If you are coding Silverlight apps for Windows Phone 7 you have probably used the ApplicationBar for your menu needs. If it’s confusing you with the way it works, or even giving you NullPtr exceptions when you try to access it’s properties, it’s because it’s no Silverlight control.
Looking at the XAML for the template “Windows Phone Application” in Visual Studio, there is an ApplicationBar defined. If you have used that template and tried databinding the ApplicationBar then you will have noticed that it’s not working, or even producing exceptions.
If you need to control the ApplicationBar in any way and change things dynamically, you need to do this from the c# codebehind. Even if you name the bar (or it’s components) with x:Name in XAML, you won’t be able to reach those objects from the codebehind.
What you need to do is to work directly with the instanced ApplicationBar from the codebehind. Say for example you need to change the icon for button number 3 on the fly, this is the way to do it: ((ApplicationBarIconButton)(ApplicationBar.Buttons[2])).IconUri = new Uri("NewIcon.png", UriKind.Relative);
This is also very important to remember if you are going to localize your app, as you can’t databind the translations as you can with all other Silverlight controls!
Thursday, November 18, 2010 | 0 Comments
WP7 - WPDT CTP Refresh

The Windows Phone Developer Tools CTP refresh is finally out. This version is now compatible with the release version of Visual Studio 2010.
To download WPDT go here.
For info about what's new, check out the Windows Phone Developer Blog.
Saturday, May 01, 2010 | 0 Comments
VS2010 - The Ultimate Tour

Today I attended Microsoft's Visual Studio 2010 - The Ultimate Tour, as they call it. This is the promotional tour from Microsoft, detailing what's new in Visual Studio 2010 and the .Net 4.0 framework.
My general impression is that not a lot have happened with C# and VB.Net languages this iteration.
For C#, Optional and Named parameters seems to be good for eliminating a lot of overloads. Also the new type Dynamic was brought up, it works like var pretty much, only the binding isn't done at compile time. Also the new data type, Tuple, that's being brought in from F# was mentioned.
More of interest was the Task Parallel Library(TPL), containing API's and data types to support easier implementation of parallelism. Introducing things like Parallel.For and Parallel.ForEach loops. Also some constructs for parallelism combined with LINQ seem pretty good.
Then there were a lot of discussion about the improvements to the Studio itself, then about WFF, WCF, ASP.NET and finally Team Foundation Server. A lot of that stuff I find less interesting. But I must say I was impressed by the test recording and then being able to connect the recordings to bugs in Team Foundation Server, this looks very good for helping the communications between testers and coders. The tester-coder blame game get's so tedious after a while.
Other than that, I think I was most pleased by the addition of Multi monitor support in the Studio itself. Maybe this is incentive enough to get a new Radeon graphics card with Eyefinity for three screens of delicious code!
I hadn't looked at the agenda before I went to the show, so I got a bit surprised when there was not a single word mentioned about developing for Windows Phone 7. I had been hoping for a fair bit of info, since it's one of the things that interest me the most now days. But looking at the American agenda for the tour, it seems the one we got here in Sweden was a shortened version. And while the American one indeed contained a segment about Windows Phone Developer Tools, that segment had been removed here in Sweden. Such a pity :(
At the end we all got a memory stick with the presentations on it, so tomorrow it's time to test out ReadyBoost on Windows Vista!
But overall it was a good presentation and a good effort from the guys from Microsoft. Thanks for the info and the cookie!
Wednesday, April 21, 2010 | 0 Comments
Keeping up with .Net, continued
After modeling my project in the UML modeling tool in Visual Studio 2010 Beta, I wanted to generate the code and get on with implementation. Strangely I couldn't find any way of generating the code in the studio. I got a bit irritated, as Microsoft always have done very well with the usability of their IDE's in the past. I tried the help, but couldn't find anything there either.
After searching the web I found a post on MSDN forums, it seems this feature isn't implemented yet and the post suggests it will be released in the RTM planned for March.
It's imperative that code generation from the model is implemented well. Regeneration of the plumbing must be implemented so that it won't overwrite implementation code. Handling of discrepancies between model and plumbing code must be well thought out, as there is always a chance that the model and the plumbing code will get out of sync if any one forgets to check in parts of code in the repository.
I regularly run in to the mess of model and plumbing code being out of sync in other tools and it's never a pleasant situation, so I have high hopes that the Visual Studio team pulls this off.
Saturday, January 30, 2010 | 0 Comments