How to Bind to the Index of a Collection in WPF

17 באפריל 2010

Let's say you have a customer class and you are binding a DataGrid to a collection of customers. You would like the index of the customer in the collection to appear in the first column, like so: One way to do this might be to add an Index property to the Customer class and bind to that. I prefer not to go that way because it would pollute our business layer with presentation layer constraints. Solution Here is a different approach using a MultiBinding. You can download the source...
תגיות: , ,
3 תגובות

Hierarchical Grid with WPF

A TreeView handles hierarchical data well, and a DataGrid handles tabular data. But what about hierarchical tabular data? A simple example of such a source is a System.IO.DirectoryInfo. Each item can have zero or more children of the same type, enumerated by EnumerateDirectories. I would like to have it displayed like this: Solution You can download the source code for this solution here. The inspiration for this solution came from Delay's Blog by David Anson. I think David's idea of measuring the indentation at each level and compensating for it in...
תגיות: , , ,
8 תגובות

Project Packager Add-In for Visual Studio 2010

12 באפריל 2010

This Add-In for Visual Studio 2010 will package up your solution (actually, any folder you choose) into a zip file excluding any files with extensions you specify and any folders whose names you specify.I cant upload msi files to this blog, so in order to install you will need to build the project. I packaged up the Add-In solution using the Add-In itself and uploaded it here. Download the solution, open with Visual Studio 2010 and Build All. Right click the setup project and select Install. ...