1 Building Data-Bound Applications with Windows Forms
Your First Data-Bound Windows Forms 2.0 Application
Creating a Windows Application Project
Adding a New Data Source and a Data Connection
Customizing Data Sources Control Mappings
Generating Data-Bound Controls
DataSets or Not, That Is the Question...
Layered Application Architecture
2 Working with Typed Data Sets and Table Adapters
Creating Typed Data Sets with the Data Set Designer
Creating a Typed Data Set and Setting Up a Data Connection
Introduction to Table Adapters
Filling and Updating a Typed Data Set with a Table Adapter
Adding Transaction Support to a Table Adapter
Adding Helper Data Access Methods
Basing Table Adapters on Stored Procedures or Views
Adding Queries to Table Adapters
Adding a Custom Query to a Table Adapter
Using the Query Builder to Write a SQL Statement
Configuring a Table Adapter to Use Stored Procedures
Creating Typed Data Sets with Command Line Tools
Using Typed Data Sets in Your Code
3 Introducing Data Binding in Windows Forms
The 40,000-Foot View of Data Binding
.NET Framework 2.0 Data Binding Enhancements
Binding Data Collections to a Grid
Binding Data Collections to Multi-Valued Controls
Binding Data to Individual Controls on a Form
Data Paths Within Data Sources
Synchronizing Data Between Controls
Updating Data Sources Through Data Binding
4 Binding Controls to Data Sources
Getting to Know the BindingSource Component
Simple Data Binding with Binding Sources
Chaining Binding Sources for Master-Details Data Binding
Navigating Data Through a Binding Source
Manipulating Data Through a Binding Source
Using a Binding Source as a Data Storage Container
Filling a Binding Source with a Data Reader
Sorting, Searching, and Filtering Presented Data with a Binding Source
Monitoring the Data with Events
Restricting Changes to the Data
Underneath the Covers of Data Binding for Complex Types
Binding an Image Column to a PictureBox Control
Binding a DateTime Column to a DateTimePicker
Binding a DateTime Column to a TextBox
Binding a Numeric Column to a TextBox
Automatic Formatting and Parsing Summary
Going Beyond Built-In Type Conversion with Binding Events
Completing the Editing Process
Making the User’s Life Easier with AutoComplete
Smarter Child-Parent Data Binding
Binding to Multiple Copies of Data
Updating Parent Data-Bound Controls from Child Data-Bound Controls
Synchronizing Many-to-Many Related Collections
5 Generating Bound Controls with the Visual Studio Designer
Working with the Data Sources Window
Adding Data Sources to a Project
Choosing the Type of Data Source
Adding a Web Service Data Source
Generating Bound Controls from Data Sources
Selecting the Bound Control Type
Customizing the Bound Control Types
Binding Existing Controls to Data Sources
Behind the Scenes: Designer Code and Data Sources Files
Other Designer Data-Binding Code Generation
Setting Control Data Binding Through the Properties Window
Generating Data Bindings with Smart Tags
Generating Master-Details Data-Bound Controls with the Designer
6 Presenting Data with the DataGridView Control
Basic Data Binding with the DataGridView
Controlling Modifications to Data in the Grid
Programmatic DataGridView Construction
Programmatically Adding Columns to a Grid
Programmatically Adding Rows to a Grid
Custom Column Content with Unbound Columns
Displaying Computed Data in Virtual Mode
Understanding Virtual Mode Behavior
Using the Built-In Column Types
Using the Designer to Define Grids
Defining Custom Column and Cell Types
Utilizing Cell-Oriented Grid Features
7 Understanding Data-Binding Interfaces
What Does Data Binding Have to Do with Interfaces?
The IEnumerable and IEnumerator Interfaces: Supporting Iteration Through Collections
The ICollection Interface: Controlling Access to a Collection
The IList Interface: Enabling Data Binding
The IListSource Interface: Exposing Collections of Collections
Property Descriptors: Allowing Dynamic Data Item Information Discovery
The ITypedList Interface: Exposing Data-Binding Properties
The IBindingList Interface: Providing Rich Binding Support
Getting to Know the IBindingList Members
Notifying Consumers of Changes to the Collection
Exercising IBindingList Change Notifications
Supporting Sorting with IBindingList
Supporting Searching with IBindingList
The IBindingListView Interface: Supporting Advanced Sorting and Filtering
The ICancelAddNew Interface: Supporting Transactional Inserts in a Collection
The IRaiseItemChangedEvents Interface: Providing Item Modification Notifications on Collections
The IEditableObject Interface: Supporting Transactional Item Modifications
The INotifyPropertyChanged Interface: Publishing Item Change Notifications
The IDataErrorInfo Interface: Providing Error Information
The ICustomTypeDescriptor Interface: Exposing Custom Type Information
The ISupportInitialize Interface: Supporting Designer Initialization
The ISupportInitializeNotification Interface: Supporting Interdependent Component Initialization
The ICurrencyManagerProvider Interface: Exposing a Data Container’s CurrencyManager
8 Implementing Custom Data-Bound Controls
Extending Framework Data-Bound Controls
Creating a Grouped Column DataGridView
Deriving from DataGridView and Handling the CellFormatting Event
Modifying the Painting Behavior of the Cell
The User Control Test Container
Developing Data-Bound Container Controls
Building a Filtered Grid Control
Adding Data-Binding Capability to a Custom Control
Supporting Designer Initialization of Data Binding
Specifying Binding Properties on a Control
Supporting Delayed Initialization with ISupportInitialize
Dynamically Determining the Properties of a Data Source
Dynamically Populating a Combo Box Control
Handling the ListChanged Event
Autocompleting Input in a TextBox Control
Autosizing Columns in the Grid
Winding Up the Filtered Grid Example
Building a Custom Data-Bound Control from Scratch
Building a Data-Bound Charting Control for Decision Support
Creating a Custom Control That Draws Itself
Defining a Custom Data Structure for Rendering
Coding a Data-Bound Custom Control
Defining the Custom Control Skeleton
Initializing and Updating the Data Bindings
Adding Bar Chart Instances to the Container
Adding Editing Support to a Custom Data Bound Control
9 Implementing Custom Data-Bound Business Objects and Collections
Defining and Working with Data-Bound Business Objects
Defining and Working with Data-Bound Business Object Collections
.NET Framework Generic Collection Classes
The CustomBusinessObjects Example
Binding the Customers and Orders Objects to Form Controls
Generating Some Test Data to Bind Against
Setting the Textual Data-Binding Behavior of Custom Objects
Supporting Transacted Object Editing with IEditableObject
Supporting Object Edit Notifications with Property Change Events
Supporting Object Edit Notifications with INotifyPropertyChanged
Using BindingList<T> to Create Rich Object Collections
Creating a Custom Collection Type Based on BindingList<T>
Taking Over the Construction Process
Getting Some Test Data to Work With
Adding Search Functionality to the Collection
Adding Sorting Capabilities to the Collection
Managing Transacted Additions to a Collection
Adding IBindingListView Functionality
Binding to Business Objects Through the Data Sources Window
10 Validating Data Input and Handling Errors
DataGridView Validation Events
Validation Up the Control Hierarchy
Displaying Validation Errors with the ErrorProvider Control
Controlling Validation Behavior with the AutoValidate Property
Validation down the Control Hierarchy
Capturing Data Errors on Data Sets
Providing Error Information from Custom Objects with IDataErrorInfo
ASP.NET Page Processing Basics
Presenting Tabular Data in a Grid
Hooking Up Dynamic Behavior in a Code-Behind Class
Handling Row Selecting in the Grid
Using Data-Binding Expressions
Data-Binding Overview in ASP.NET 2.0
B Binding Data in WinFx Applications
WinFx UI Programming and Capabilities Overview
Writing a Simple WinFx Application
Getting Started with a “Hello World” Application
Building a Slightly More Involved Application
Data Contexts and Data Sources
Binding a Collection to a Grid with Templates
C Programming Windows Forms Applications
Your First Windows Forms Data Application
Creating Windows Forms Applications with Visual Studio
Creating an Empty Windows Forms Project
Hooking Up an Event Handler and Data Binding
Windows Forms Designer-Generated Code (New in 2.0)
A Brief Tour of the Windows Forms Architecture
The Dawn of .NET Execution—The Main Method
Containing Forms Within a Parent Form
DataGridView Controls (New in 2.0)
Creating a Custom User Control
Absolute Positioning and Sizing of Controls
Using Layout Container Controls (New in 2.0)
Command and Control of Your Windows Forms Applications (New in 2.0)
Creating a Data Set Programmatically
Loading Data Sets from a Database
Loading a DataTable with a DataReader
Retrieving Data with Stored Procedures
Updating the Database Using Data Sets
Updating with Data Sets and Stored Procedures
Merging Data from Multiple Data Sets
Scoping Transactions with System.Transactions
Data Set and Data Adapter Events
Reading Data into Business Objects
Working with the XmlDataDocument Class
Working with the XPathDocument Class
18.119.104.10