Pages

Wednesday 29 April 2009

First Contact with DevExpress

Recently I had the opportunity to use DevExpress controls for WinForms. Overall I wouldn't say those controls save you time if you compare with regular Windows Forms controls. The time you save in coding you spend it reading documentation and experimenting with the controls. However the results are definitely superior to WinForms: better looking and with plenty of niceties that come for free (grouping, sorting, customizing, dragging and dropping, advanced tooltips, etc...) The controls I used to far:
  • GridControl
  • VGridControl
  • PropertyGridControl
  • TreeList
GridControl Comes with plenty of default features such as very powerful grouping and filtering options accessible to users at runtime. To populate it, simply set its DataSource to a DataTable or an IList.
  • If all you do is setting the DataSource then the control doesn't know anything about the data layer, which is good.
  • However if you add columns from the designer (either manually or from a datasource) then you create a tight coupling with the data layer, which might be ok depending in the type of app you're creating. I find the designer is great for discovering functionality but when given a choice, it is better to write code: this avoids having the UI know too much about the data.
VGridControl and PropertyGridControl
From a distance VGridControl looks like a Property grid control. The main difference is you can display many records at a time while a property grid control displays a single record.
  • Both theVGridControl and PropertyGridControl use reflection to display the properties of an object.
  • For some reason PropertyGridControl works fine for public properties with exotic types (such as collections) while VerticalGridControl simply doesn't display collection properties -unless there is something I missed...
TreeList The first column contains the tree, the other columns display data in a grid. Handy when each node of the tree contains usefull info and you don't want users to click each node to see the info. Instead you display the info directly in the grid and users can sort and filter as they see fit.
Most of the effort with the DevExpress controls is working out what they do. Two main sources:
  • The DemoCenter that comes with the DevExpress install
  • The blonde and brunette from DevExpress TV