August 14, 2008

Custom Sort Icons with Silverlight 2's DataGrid Control

While looking through the control templates for Silverlight 2's DataGrid, I noticed the DataGridColumnHeader defines a couple of StoryBoards that allow you to control how the headers are displayed as they pass through the three column states: {Sorted Ascending, Sorted Descending, Unsorted}.  And without too much work you can override the default display and customize it to your liking.  I took a crack at overriding these states to mimic the icons the awesome jquery tablesorter plugin uses - below is a sample table that shows how it turned out.  Read on for the details (there really aren't too many) and don't forget to check out the live demo and download. Live Demo | Download   Default Sort Indicator If you look at the default template for the DataGridColumnHeader you will see the control uses a Path shape (named SortIconElement) to describe the sorting icon (the value of the Data attribute...

Topics: Silverlight 2

August 10, 2008

Angled Column Headers with Silverlight 2's DataGrid

At the software shop I work at screen real-estate is always at a premium.  The bread and butter of our business is data, and the more of it we can fit on a screen the happier our customers are.  Sometimes, to cram more data into our grids, we end up abbreviating column headers, wrapping them or possibly combining 2 or 3 data elements into a single cell.  Usually this works out O.K., but sometimes we still run out of room.  When this happens we either remove columns, or break the grid across separate pages.  Honestly, usually none of this is a huge problem.  But there is that certain class of data that just doesn't fit well into an HTML TABLE - when the length of the data elements are substantially smaller than the data label's.  The grid ends up looking too sparse.  I hadn't thought of this before, but football...

Topics: Silverlight 2

March 26, 2008

Sorting with Silverlight 2's DataGrid Control

So I am just starting to get my feet wet with Silverlight 2.  I have gained some confidence over the past few days, but on the crawl, walk, run scale it feels like I am still crawling.  Beginner or not, I figured I would take a shot at getting Silverlight's DataGrid control to support sorting.  Nothing too complicated - just the standard click on the column header to sort the data.  Surprisingly, I didn't see much on MSDN talking about how to implement sorting using the DataGrid.  I know the documentation is still in the works so I am sure it is coming, but I was a little bit concerned about how to get started.  No worries though, it turned out to be a breeze.  If you are interested in the details, I have a quick description of what I did just beneath the following screen shot. Live Demo |...

March 23, 2008

A Quick Look at Silverlight 2's DataGrid Control

If you follow my blog, you have probably noticed my obsession with data grids.  I haven't actually checked my archives, but if I had to guess I would bet somewhere around 70% of all my posts in some way include ASP.NET's Repeater, GridView or ListView controls.  Lately I have been taking a look at Silverlight 2 so naturally I was curious when I saw Scott Morrision's post titled Using the Silverlight DataGrid.  I eagerly read through his post and started working on creating a very basic demo app.  I thought a good way to introduce myself to the DataGrid would be to build a page that allows me to set the values of the DataGrid properties so I could watch how it effects how the DataGrid presentation (usually this is what a designer is for, but it wasn't working so well for me.  I am sure it's user error.).  Anyway,...

March 18, 2008

Creating a Custom Skin for Silverlight 2's Button Control

For the past couple of weeks I have been reading about Silverlight 2.  I have gone through ScottGu's tutorial, checked out the deep zoom demos (here and here) and even browsed the XAML for some sample control themes.  But I haven't actually tried to build anything myself yet.  So I thought I would put together a small sample around Silverlight's styling and templating features by creating a skin for the Button control that looks somewhat like the a button renders in IE7 on my Vista box.  I know that in a way it's taking a step back (Silverlight's default Button is really pretty sweet looking), but I didn't want to be too overwhelmed for my first sample.  The grid below shows what my Button control looks in each of the 4 states the Button supports.  If you look close at the Buttons background, you can see it has that nice...

March 12, 2008

Live Demo of ScottGu's Silverlight 2 Beta 1 Digg Application

This afternoon I made a second pass through ScottGu's 8 part tutorial on Silverlight 2 Beta 1.  This time around I downloaded his demo application, browsed the source code and played around with the app a little bit.  It was all very impressive.  And to be honest, a little bit overwhelming - everything is new again. I didn't see any live demo links on Scott's blog, so I thought I would upload his digg demo app to my web server.  So if you want to view his app without downloading the code (or if you don't have VS 2008), you can view the live demo here.  Hopefully Scott won't mind ... Also, the search box does a search for digg stories based on topic so if you enter a topic that doesn't exist nothing really happens.  Some good search terms to use are basketball, baseball, golf programming, hardware, microsoft Live...


Consulting Services

Yep - I also offer consulting services. And heck, I'll do just about anything. If you enjoy my blog just drop me an email describing the work you need done.

Recent Comments

  • TimothyP wrote: I work with tons of developers who haven't even got a clue what Twitter of Facebook is. In fact, it'...
  • Janko wrote: Yes it's strange that people think it's ok to blog at work but consider unethical to use facebook. P...
  • Kam Lagan wrote: Hi Matt, The numbers do seem a little "off" to what you perceived the community would be like. But...
  • Siderite wrote: You're kidding me! So the people that don't blog think it is ok to blog at work (maybe because they ...
  • Guy Harwood wrote: Good to see the results. one typo.... 'What best describes your current job title?' appears twice,...
  • sirrocco wrote: One problem with : DEV I DEV II DEV III was that I didn't know what it meant :( .(is it common ...
  • Jack wrote: How many person fill the survery? Blog is very common, so I don't think 71.5% is high. Maybe our bos...
  • Andy wrote: Done. The developer1, developer2 question - not sure how meaningful the results are going to be for ...