Winforms DataBinding Bliss

My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2003/6/19/winforms-databinding-bliss.html
Published Thursday, June 19, 2003 2:16 PM by RoyOsherove
Filed under:

Comments

Thursday, June 19, 2003 3:23 AM by Duncan

# re: Winforms DataBiding Bliss

You're not kidding - I added IBindableList to my printer monitor component and hey-presto, a data grid of print jobs that is updated as the queue changes...can you imagine how difficult it would have been to do that in VB.Classic.
Thursday, June 19, 2003 3:46 AM by Roy Osherove

# re: Winforms DataBiding Bliss

Duncan: That totally rocks :)
Thursday, June 19, 2003 4:13 AM by Frans Bouma

# re: Winforms DataBiding Bliss

Try this with a datagrid:
- autoresize all columns to the longest string in the column. (requires pixel counting in custom dirty code relying on hwnd)
- bind a custom collection with custom classes and make the collection sortable. (get geared up for some serious ITypedList implementation and creation of property descriptor classes)
- include versioning in your custom classes in your custom collection when editing is enabled through a binded datagrid.

I'm pretty sure you're not having fun then :) For basic bindings, like binding a dataset or a simple readonly list, it's ok. For every job that requires more, it's horrible.
Thursday, June 19, 2003 4:20 AM by Roy Osherove

# re: Winforms DataBiding Bliss

Frans: I agree. Some things are better left alone, but I would use it a lot for read-only situations...
Thursday, June 19, 2003 4:25 AM by Frans Bouma

# re: Winforms DataBiding Bliss

Agreed, for read-only viewing it can be very helpful. I wished it was more usable though. Ah well... perhaps some day.. :)
Thursday, June 19, 2003 4:31 AM by Roy Osherove

# re: Winforms DataBiding Bliss

Hey Duncan: just realized your company was the one who released EventVB and the lobalHotKey control. Cool stuff!
Thursday, June 19, 2003 5:39 AM by Duncan

# re: Winforms DataBinding Bliss

There's a .NET global hotkey component up there - but there is no need for EventVB in the .NET world (thank goodness - it was taking over my life).

Do you know of an intuitive way to indicate that items in a grid can be moved up or down the ordering? I want to allow reordering of the print queue (subject to access rights, natch) but can't think how to visually represent it.


Thursday, June 19, 2003 7:11 AM by Roy Osherove

# re: Winforms DataBinding Bliss

huh. Tough one. How about:

*If some of the rows are movable and some arn't how about using an icon column to represend a 'locked' row and an 'unlocked' row?

* actually, I'm not sure I'd use the datagrid for that, but something like a listview, since I can then use Drag-drop features. I'm not sure if you can imple,ent that functionality with a datagrid, but drag-drop is the most natural form of moving thing for a user...

* how about, for rows that are movable, the mouse cursor changes to a special 'drag' icon, like a hand or something?

*Maybe have two up/down arrow buttons on the side that only show when a movable row is selected...

* use tooltips to indicate the hovered on row that you can move it

*Movable rows are colored differently...

I can think of lots of things, it all depends on the look and feel of the app in question and what fits best with the overall design....
Thursday, June 19, 2003 7:13 AM by julie

# re: Winforms DataBinding Bliss

yeah - binding's great but I gave up on that control when I was trying to do "simple" things like implement a check box in the columns (you have to write a major workaround) or better yet, identify when the user has clicked on that check box. Can't be done! I am now a HUGE fan of Janus Gridex!!! I think everyone that uses it loves it.
Thursday, June 19, 2003 7:17 AM by Greg Robinson

# re: Winforms DataBinding Bliss

Beyond rocks, it rules. We are using the heck out of it and it has saved tons of time. Lots to learn but once you understand the internals, baby it rules!
Thursday, June 19, 2003 7:34 AM by Roy Osherove

# re: Winforms DataBinding Bliss

Julie: Have you tried looking at the DataGrid FAQ? It has some tips on diong CHeckBoxes on DataGrids:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp
Thursday, June 19, 2003 7:38 AM by julie

# re: Winforms DataBinding Bliss

In fact, that was where I finally read that it "can't be done" which was the last straw that pushed me to Janus! btw: www.janusys.com :-) I believe Greg is also referring to GridEx in his rave review since someone named Greg also just emailed me (excellent use of the contact form, there Greg!!) to say how much he loves GridEx also.
Thursday, June 19, 2003 7:53 AM by Roy Osherove

# re: Winforms DataBinding Bliss

Julie: Is it pure managed code or is it the good ol' interop grid I know and love from my VB days?
Thursday, June 19, 2003 7:54 AM by Roy Osherove

# re: Winforms DataBinding Bliss

nevermind, just went to the site :) looks cool!
Monday, June 21, 2004 5:50 AM by Tim

# re: Winforms DataBinding Bliss

Hi Roy,

I've seen your blog entry is from last year, so you've probably moved on a bit. Thought you might be interesting in combing n-tier and databinding if you haven't already. Check out www.hyatt.lu for 3 good articles and forum support.

Tim at ims dot co dot nz