Print Page | Close Window

BindingSource and DataGridViewBindingSource in the Cabana App

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=589
Printed Date: 13-Oct-2025 at 8:29pm


Topic: BindingSource and DataGridViewBindingSource in the Cabana App
Posted By: gussabina
Subject: BindingSource and DataGridViewBindingSource in the Cabana App
Date Posted: 06-Dec-2007 at 10:13pm
Hi All:
Why the Cabana App doesn't use the DataGridViewBindingManager and the BindingSource objects for the Order and OrderDetails datagrids? I assume this is not possible, as it is not implemented in this way... I mean, in the IdeaBlade tutorial, the Orders and OrderDetails use BindingSources and DataGridViewBindingManagers for those implementations, but in the Cabana sample App, all those datagrids are implemented using a hand-coded class (without templates...) throught the OrderMasterDetailTabViewControllerBase class....
In fact, I tried to include the order datagrid using the BindingSource and the DataGridViewBindingManager, but it doesn't work....
 
 
Any idea?
 
Thanks in advance!
 
Gus
 



Replies:
Posted By: Bill Jensen
Date Posted: 03-Jan-2008 at 11:36am
Hi Gus,
 
Sorry I haven't been able to respond sooner.  Things have been busy.
 
The DevForce tutorials are intended demonstrate data grid binding using standard Windows Forms techniques.
 
Cabana is based on the CAB architecture and tries to abstract common functions to minimize dependencies between components.  In Cabana, grid views and their presenters are defined (in IdeaBlade.Cab.DotNet or IdeaBlade.Cab.DevEx, depending on the control suite you're using) and do make use of binding managers and data sources.  They are registered with the ViewFactoryService under the well-known name "BasicGridView".  
 
A layout view controller (or its helper TabViewController) can have the ViewFactoryService create a unique gridview instance and add it to the workitem on demand, without worrying about the specific implementation.
 
The layout or tab view controller exchanges information (such as the data source to supply data to the grid) with the view (actually with the view's presenter) via a ViewContext object, created and added to the workitem by the controller.
 
The actual construction of the grid (adding, binding and styling columns) is performed by a GridBuilder object (again accessed by name from a service)that knows about a specific entity type (e.g., Order or OrderDetails).  In this way, the application can include grids displaying orders in many places (on a customer screen and a sales rep screen, for example) without statically defining and styling a new grid each time.  Moreover, all of the grids displaying orders can be modified (to add or remove a column, for example) just by modifying the OrderGridBuilder.
 
In version 2.3.0.1, wizard-generated grid views (with the DotNetGridView item wizard) do not follow this pattern.  The binding manager is accessible in the designer and may be used to statically add and bind columns of the grid.  Unfortunately, the grid itself is in a base class and cannot be styled (e.g., column widths, colors, etc.) with the forms designer.  A wizard-generated grid view can be converted to use a grid builder by passing the grid builder name in the view context.
 
This will be corrected in the next Cabana version.
 
Hope this sheds some light on the situation.
 
Bill Jensen



Print Page | Close Window