All 8 entries tagged Data Binding

No other Warwick Blogs use the tag Data Binding on entries | View entries tagged Data Binding at Technorati | There are no images tagged Data Binding on this blog

March 31, 2006

Provided Views

Writing about web page

I've been doing more work on the BindingListView project.

A problem I faced was when displaying a master-details style UI. I could make the master list a BindingListView (with filtering, sorting, etc) but then the child "details" list would just be whatever the business object had defined it as e.g. List.
While the business object developer could add an additional property that exposed a BindingListView of a list, that violates the separation of business logic and UI logic. (Since a view is really only for the UI's benefit.)

The solution was to make the view object provide additional properties at runtime using its ITypedList interface implementation. Basically, it looks for properties that implement generic IList and then returns additional properties for a BindingListView of those. The actual view objects are stored in the EditableObject wrappers of source items.

So I can now set the DataMember of a child bindingsource on my form to something like "OrderView". This is the provided view of the "Orders" list.

November 19, 2005

Screen Cast #2 – More on the Data Bound Tree View

Here's the second screen cast

It shows off the more advanced features of the Data Bound Tree View control. These include binding to a recursive data structure, automatic node reordering upon source list sorting and dynamic custom node creation.

Check it out and let me know what you think!

November 17, 2005

Screen Cast #1 – Data Bound Tree View

Writing about web page

I decided that trying to write about the projects I've been working on would take too much time and not really get across the ideas as easily as just showing you! Therefore I decided to have a go at a "screen cast".

This first video demos the basics of my new Data Bound Tree View control. I'm still playing around with recording settings, etc, so hopefully the quality will improve for the next one.

Any comments, suggestions are welcome.

November 08, 2005

Recursive Data Bound TreeView

Follow-up to Data Bound Tree View from codeMonkey.Weblog();

I decided that my data bound treeview control should support recursive data structures. For example an OPML file consists of a set of "outline" elements and each outline can have child outlines inside. Therefore I've added a method to the control called "AddRecursiveLevel". So the tree will then recurse over the data structure until all leaves have been reached. The recursive level cannot have a CurrencyManager to update because that would require changing the data source of it (which can't be done easily). It does not make much sense to have an idea of "currency" when dealing with arbitrary depth tree data structure. The solution is to add a SelectedDataItem property to the control. Code that uses the treeview control can data bind that property to the datasource property of a BindingSource component. Other UI controls can then bind to that BindingSource. That way the user can drill down to a node in the tree view and then edit data using controls bound to the selected item.

There is still a fair bit of work to do in terms of enforcing constraints and documentation. I'm very busy getting ready for my trip to the USA on Thursday. Hopefully when I return I will have some more free time to work on the control.

October 27, 2005

Data Bound Tree View

I just wanted to mark this moment time as when I got my DataBoundTreeView control working! I'm going to put up a full post later explaining what it actually is. I am however very pleased with it! :D

October 22, 2005


Writing about web page

It took an afternoon of coding (and about a day or so of background thought process from the past month), but I finally created a working data-bindable aggregate object list view class. It grew out of the BindingListView project . The extension is that now multiple source lists of items can be merged into a single view. This view can then be sorted, filtered and searched.
An example of where this is useful would be an RSS feed reader application. Here you would want to show a single feed's list of items and also allow the user to view all items from all feeds. The user should be able to sort the items and search, etc, even when viewing all items from all feeds. The AggregateBindingListView does just that!

The plain old BindingListView is infact a degenerate case of the aggregate class, i.e. has just one source list of items. I have therefore now made it simply inherit from AggregateBindingListView and add an additional constructor that takes the list to view.

One special point for people using the ABLV class, the "NewItemsList" property must be set before items can be added using UI controls like the DataGrid. That way the ABLV knows which list to add the new item to. Otherwise adding new items in that way is disabled. (BindingListView automatically sets that property in the constructor, so no changes needed there.)

I'm very happy with the code and have put together a simple RSS reader application to test it. More testing is required, since the concept of merging multiple lists and keeping things like additions, edits, deletes in sync is by no means straight forward. I also need to complete/update the XML documentation. A further addition to the library would be a class to parse SQL style filter predicates. (We already have a SQL sort property implemented.) This is a fair amount of work, but would allow things like:
view.ApplyFilter("Name LIKE 'A*' and Age >= 18")
Currently only coded filters (classes that implement IFilter) exist.

Any interested coders are welcome to join the GotDotNet workspace linked above.

September 17, 2005

WinForms Error Binding

I created a component that handles the boring job of hooking up an object that implements IDataErrorInfo to an ErrorProvider on a form. The data bound object has to implement my IRuleTrigger interface by having two events RuleInvalidated and RuleValidated. These events are listened to by my RuleBinder component. It then enumerates the controls on the form looking for data bindings relevant to the data object. ErrorProvider.SetError is invoked to either set or clear the error on controls as needed.
So now the business object is in control of business rules and the RuleRinder takes care of setting the relevant UI. Thus eliminating all those TextBox.Validated event handlers.
If I get the code commented up properly (when I'm less busy) I'll post it online. It looks like I'm building up a fair amount of code here for a rather nice "Data Binding Framework" library.

September 02, 2005

Aggregate Lists

Has anyone seen aggregate lists anywhere before?
What I mean is given multiple of lists of a business objects (of the same type), I want to have a list that contains all the objects from all the lists. Of course I require any changes in the source lists to be reflected in the aggregate list.
I've done some quick Googling, but found nothing in this area.

I may extend my BindingListView into a BindingAggregateListView that takes multiple IBindingList implementors. It would then be able to sort and filter over all the items.

Example of use:
Say I have 10 Customer objects and each customer has a list of Order objects. I want a form that displays all the orders from all customers (and lets me filter/sort the data). I don't really want to have extra code and queries that pull back a separate list of orders, since I want changes made to be put into the actual Customer's order item.
So an aggregate list of the existing Order lists would work great.

Google Ads

Search this blog

Most recent comments

  • I scratched my eye while i was holding some kind of plastic packaging.. Anyways the corner of the pl… by Ercan on this entry
  • About a year ago my contacts that i was wearing, i guess were fautly, because shortly after they wer… by Jon on this entry
  • I got shower gel in my eye 4 and a half days ago, and becasue i rubbed my eyes a lot, i have scratch… by Chris on this entry
  • This website may help–health/tc/Eye–Injuries–Home–Treatment by S on this entry
  • I somehow got dirt, or debris in my eye. The terrible pain sent me in a tailspin. I was afraid of sa… by Bobbi on this entry


October 2021

Mo Tu We Th Fr Sa Su
Sep |  Today  |
            1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31


Blog archive

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder