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, I found this little app useful so I figured I would post the demo and source.
Also, just in case you haven't seen - the Silverlight DataGrid supports column resizing and freezing column/row headers! If you play around with the demo page you can see how this looks.
That's it. Enjoy!
Comments
http://codebetter.com/blogs/david.hayden/archive/2008/03/23/orlando-code-camp-rocked-wcsf-and-data-access-tips-and-techniques-presentations.aspx
Recognize anything on this page.. What better way to say you ROCK! than to use your stuff.
Stephen
Just wanted to tell how much i interest and learn from your examples, the most thing made you different, is the live examples :)
thanks.
Hi,
yes it looks good! I have just encountered small bug which might be just in my PC. When I click Opacity the screen changes to blank?
Also does this grid has the sorting ability?
Thanks for the example, Matt! Have you figured out how to implement Sorting in the DataGrid? I cant seem to get access to the Click event for the header ala WPF... is there another approach for SL2?
@Stepehn -
Yep - I sure do. And it looks great.
@Amr -
Yea, I wish more bloggers would do this. Code snippets are great, but I like being able to watch it live.
@ajaxus -
I havent had a problem with the opacity on either of my PCs (XP with IE7 or Vista with IE7). Anyone else seeing this?
@ajaxus, Ethan -
I havent figured that out yet, but it is on my short list. I will write up a quick post once I get it figured out.
Compliments, great example.
About the Opacity, Im using Vista, IE7, Silverlight 2.0.30226.2, clicking an Opacity setting doesnt change the opacity here.
The opacity works great for me (Vista, IE8), and thanks for the live demo, Matt.
Matt,
Have you found a way of sizing the width of the columns based on the page size? I have also noticed that I always get an extra column on the right hand side of the grid to fill the space – have you found a way of handling this?
Thanks
Richie
Thank you Matt,
Very nice!
David
Correction, not for any object, but for any arbitrary set of properties.
Thanks
This is beautiful!
Thank you, Matt!
Have you found a way of sizing the width of the columns based on the page size? I http://www.batteryfast.co.uk have also noticed that I always get an extra column on the right hand side of the grid to fill the space � have you found a way of handling this?