WPF

WPF and Visual Studio Addins

If at all possible nowadays, I write all my Windows UI code in WPF, it’s just quicker and easier than WinForms. Recently however, I came across a situation that you should just avoid. If you’re developing addins for multiple versions of Visual Studio - don’t use WPF for the Tools > Options windows. It’s just noit going to place nice out of the box. This is because there’s a lot of property page Win32 stuff going on in the host window that makes it hard to route messages properly - keyboard entry won’t work correctly, tab order will be messed up and more, it’s just not worth the pain.
Read more

Introducing FireKeys

I don’t know when I learnt that Windows + E opened up Windows Explorer. It must have been a while ago. But it’s imprinted in my muscle memory, the number of times I hit that combo every day is probably quite high. But how many other hotkeys do I use? Asides from a few other functional ones, like Win + D, I don’t use hotkeys so much. And I got to thinking, I’d love to open Google Chrome with a hotkey just like I do with explorer.
Read more

Funky WPF - Enumerations and the Combo Box

Binding a combo box to an enumeration in WPF is more work than it should be, creating an object data provider etc etc: <Window.Resources> <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="CharacterEnumValues"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="Character" /> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> </Window.Resources> Followed by <ComboBox SelectedItem="{Binding Character}" ItemsSource="{Binding Source={StaticResource CharacterValues}} "/> What a pain! I have just added 'EnumerationComboBox' to my Apex library - so now you can do this: <!-- The combo box, bound to an enumeration.
Read more

MVVM Commanding

I have written an article that describes commanding in WPF, Silverlight and WP7 in detail. It is on the CodeProject at: http://www.codeproject.com/KB/WPF/consistentmvvmcommands.aspx It uses the latest version of Apex (version 1.2) which will be released formally shortly. Enjoy!

MVVM: Asynchronous Commands

The latest cut of the Apex Code (http://apex.codeplex.com/SourceControl/changeset/changes/6701) contains a very cool new feature - Asynchronous Command Objects. An Asynchronous Command is a ViewModelCommand - the standard object used in Apex for commanding. However, what is different about this function is that it runs Asynchronously. One of the problems with running a view model command asynchronously is that generally the view model properties cannot be accessed - as they're created on a different dispatcher.
Read more

Drawing a DIB Section in WPF

One of the most exciting new features in the forthcoming SharpGL 2.0 (which was actually planned for 2.1 but has been moved to 2.0) is the facility to do OpenGL drawing in a WPF control. This isn't done via a WinFormsHost (which has unpleasant side-effects due to Airspace, see http://msdn.microsoft.com/en-us/library/aa970688(v=VS.100).aspx) but actually via an Image in a WPF UserControl. What does this mean? Well it means that when you use the SharpGL.
Read more

Solitaire and Spider Solitaire on the CodeProject

I have uploaded a new article on the CodeProject, a step by step tutorial showing how to create Solitaire and Spider Solitaire for WPF with the help of Apex. The article is available at: http://www.codeproject.com/KB/WPF/solitaire.aspx