-
Notifications
You must be signed in to change notification settings - Fork 0
Data Binding
CodeModeler-generated collections are designed to be bound to any .NET controls whether they are ASP.NET, Windows Forms, Windows Presentation Framework (WPF) or else. All those controls usually need is a specific .NET interface implementation and that's precisely why these collection classes implement so many of them: so, you can bind those collections to approximately anything in the .NET framework but also to all third-party controls supporting those standard interfaces. The following is a list of interfaces implemented by generated collection classes:
-
IEnumerable
-
IList
-
IList<T>
-
ICollection
-
ICollection<T>
-
IBindingList
-
IRaiseItemChangedEvents
-
INotifyPropertyChanged
-
INotifyCollectionChanged
-
ICancelAddNew
Depending on which control you want to bind your collection to, the fact that the collection implements one specific interface might become handy. For instance, the fact that the standard .NET ICancelAddNew interface is implemented, provides the developer transactional capability when adding a new item to the collection. However, the most important implementations are those of IBindingList and its generic implementation as well IBindingList<T>. By implementing this interface, all CodeModeler-generated collection classes provide features to support both complex and simple scenarios when binding them to a data source. Hence, data binding is fully supported by default by CodeModeler, and without any further modeling or configuration at design time.
For instance, we'll create a small Windows Forms application displaying all orders issued by a selected customer. Each order can contain one or more product:
On the client side, here's how to bind the complete list of customers to a ComboBox:
private void BindCustomers()
{
customerComboBox.DisplayMember = "Name";
customerComboBox.ValueMember = "Id";
customerComboBox.DataSource = CustomerCollection.LoadAll();
}
- Introduction
- Architect Guide
- Concepts
- Using Visual Studio
- Overview
- Creating a CodeModeler Project
- Visual Environment
- Project Hierarchy
- Design Surface
- Customizing Design Surfaces
- Ribbon Bar
- Property Grid
- Member Format Expressions
- Model Grid
- Method Editor
- View Editor
- Instance Editor and Grid
- Resources Editor
- Inferred Model Viewer
- Building
- Project Physical Layout
- Source Control Support
- Generating
- Aspect Oriented Design (AOD)
- Developer Guide
- The Business Object Model (BOM)
- CodeModeler Query Language (CMQL)
- Starting Guide - Tutorial
- Upgrade From CFE