Saturday, 11 May 2013

DataGrid style for MahApps.Metro - Update

I've been making some updates to my DataGrid style to make it more like the DataGrid in Windows Azure.

MahApps.Metro DataGrid Style

Check out the pull request to MahApps.Metro or my branch on GitHub.

Monday, 6 May 2013

DataGrid style for MahApps.Metro

I've just been working on a DataGrid style for MahApps.Metro. Rather than post all the code here, check out the code on my GitHub branch.

MahApps.Metro DataGrid Style

I've also submitted a pull request to MahApps.Metro so maybe it can make its way into the framework.

Sunday, 5 May 2013

Data Binding a Static Resource in WPF

I was recently trying to create a data template for data binding a list of objects, each one defining an icon to display from MahApps.Metro.Resources Icons.xaml. I found a solution by Pedro Sampaio to extend StaticResourceExtension to make it bindable, but I was having some issues such as not being able to dynamically change the colour of the icons, or use the same icon multiple times.

I decided to go for a simpler solution and create a converter which would convert a string, being the resource key, to the icon's geometry. The converter has to make some assumptions to the location of the Icons.xaml file and the structure of its contents. The converter caches the icons geometry once accessed.



The objects being databound have a string property for the resource key of the icon to use, and this is bound to the a Path's Data property in the data template, which allows the Fill property to be changed dynamically.

Thursday, 2 May 2013

CodePlex / Azure Metro TabItem Style for WPF

I've been working on a TabItem style for WPF to combine both the tab style on the CodePlex website and Windows Azure website.

CodePlex Tabs

Azure Tabs

The main difference apart from the inclusion of the icons on the Azure tabs is the mouse over style. On CodePlex when you mouse over a tab it colours in the bottom border. On Azure the coloured border is always there, and hovering the mouse fills the tab in blue.

I have gone for the mouse over style from Azure with the tabs from CodePlex. I have also made a replica of the navigation tabs at the top of the Azure page.

WPF Style
As I have been using MahApps.Metro for my styles, my style uses some of their resources, but could easily be updated to work standalone. Simply add the following styles to a ResourceDictionary to use them. The border colour of the tabs can be changed by modifying the BorderBrush property.





An example of using the styles:

Wednesday, 1 May 2013

Introduction

I decided to start a blog to share some of my findings to the world. I started my job as a .NET developer back in September 2008 and have often found the solution to my problems on other developer's blogs, or sites such as StackOverflow.

I'm currently working on a .NET 4.5 WPF application, using Caliburn.Micro for the MVVM framework, and MahApps.Metro for the styling. I'll be sharing anything useful during my development.