Archive | October, 2010

RadioButton and IsThreeState

21 Oct

CheckBox and RadioButton both inherit from ToggleButton. ToggleButton contain a bool property called IsThreeState. It enables the control to have three different values: true, false and null. This functionality is handled automatically by the CheckBox control:

2010-10-21_214156

It’s a different story for the RadioButton control. Actually it’s against the nature of a RadioButton to hold a null value and to be able to uncheck it once it’s checked (unless another RadioButton is checked). It’s the same reason that we will never be able to set the IsChecked value to null by clicking it but only by setting it initially.

Even though it’s not logical it’s possible to achieve the same functionality in a RadioButton control as a CheckBox control. First step is to create a new custom control and inherit from RadioButton. Second step is to override the OnClick eventhandler. In the OnClick eventhandler we need to manually handle the three steps that IsChecked can achieve. Finally we need to create a custom style that is set in the constructor.

2010-10-21_220020

In the ControlTemplate we have to implement the visual elements that should be shown when the RadioButton is in indeterminate state.

With the style in place we now have the full IsThreeState functionality:

2010-10-21_220358

You can download the sample project here: http://bit.ly/ajSdEj

by xamlgeek
twitter.com/thomasmartinsen

Rethink your design for WP7

18 Oct

I have just been watching 100+ videos about apps and games for Windows Phone 7 (http://bit.ly/90KcEd). Most of them are actually some pretty cool apps!

Just before watching the videos I read this article about the differences in the iPhone chrome and the Windows Phone 7 chrome (http://bit.ly/cVOegf). A short article that focus on some of the visual differences between the two phones.

When I saw the videos one thing keeps popping up – some of the apps are not designed for Windows Phone – they are designed for iPhone! If you take a look at the UI and the navigation they are obviously designed to run on a phone that provides a more static and grid-based UI instead of a fluid and living UI.

I hope that many of the big companies spend the extra design hours and enhance the UI for their Windows Phone 7 apps instead of just converting them – rethink the design and enhance the end user experience.

That said, many of the apps looks really cool and I’m looking forward to take them for a spin!

by xamlgeek 
twitter.com/thomasmartinsen

Parameters and Navigation in Windows Phone 7

13 Oct

Sending and retrieving parameters through page navigation can be really useful. Windows Phone 7 uses a navigation system that allows this feature using the NavigationContext and QueryString.

Sending a parameter

Sending a parameter is just like sending a QueryString parameter as part of an url and I use the NavigationService to navigate.

2010-10-13_012117

Receiving a parameter

Receiving a parameter is just as easy as sending it and just like receiving a normal QueryString parameter. To receive the parameter I’m using the NavigationContext that can retrieve QueryString parameters.

2010-10-13_012938

by xamlgeek
twitter.com/thomasmartinsen

Windows Phone 7 code camp tour 2010 in Århus

11 Oct

During October the Windows Phone usergroup (WPDEV) are doing a Windows Phone code camp tour around cities in Denmark.

Our opening code camp was this weekend in Aarhus (the city of JAOO => GOTO) and 22 developers choose to spend their weekend with us.

Saturday was all about application development for the phone in Silverlight. Sunday was about building games in XNA.

SAMSUNG

Next weekend is in Aalborg, then Odense and finally it’s in Copenhagen. You can see the program at http://wpdev.eventbrite.com.

by xamlgeek 
twitter.com/thomasmartinsen

WP7 code camp udsolgt i København

5 Oct

Windows Phone brugergruppen afholder i løbet af oktober en 2 dages Windows Phone 7 code camp i de største byer i Danmark. Der er meget begrænsede pladser til disse events og allerede nu er der udsolgt i København (der er oprettet en venteliste).

Der er stadig ledige pladser i Århus, Odense og Aalborg:

Århus 9.-10. oktober
http://www.eventbrite.com/event/865812669

Aalborg 16.-17. oktober
http://www.eventbrite.com/event/881032191

Odense 23.-24. oktober
http://www.eventbrite.com/event/881034197

og vi har åbnet for ventelisten til København:

København 30.-31. oktober
http://www.eventbrite.com/event/881038209

Vi glæder os til at en masse udviklere i løbet af de næste 4 weekender!

by xamlgeek
twitter.com/thomasmartinsen

Silverlight MVP

5 Oct

mvpLast Friday I received the 2010 Microsoft MVP Award and can call myself Silverlight MVP for the next year (YEAH!!!). It was a big and very pleasant surprise and since then I have received MANY congratulations – thank you so much!!! Also a big thanks to “the gangster” and his amazing team!

Looking forward to blog a lot more about Silverlight and Windows Phone 7.

by xamlgeek
twitter.com/thomasmartinsen

Follow

Get every new post delivered to your Inbox.

Join 1,413 other followers