Đang chuẩn bị liên kết để tải về tài liệu:
Microsoft ADO .NET 4 Step by Step - p 39

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Xây dựng các dự án WPF rất đơn giản bằng cách kéo-và-thả các kỹ thuật, nhưng khi dự án ví dụ chứng minh, nó có thể chỉ xem các hồ sơ ban đầu trong bảng đến. Các ngôn ngữ cụ thể các dự án sau đây thêm các tính năng điều hướng. | 356 Microsoft ADO.NET 4 Step by Step 5. Run the program. When the form appears it displays the first record from the CourseCatalog table. Chapter 21 Binding Data with ADO.NET 357 Building the WPF project is simple using drag-and-drop techniques but as the example project demonstrates it s possible to view only the initial record in the incoming table. The following language-specific projects add navigation features. Adding Navigation to a Data-Bound WPF Window C Note This exercise continues the initial WPF exercise in this section. 1. Add four Button controls from the Toolbox panel to the WPF window surface. Name the buttons ActFirst ActPrevious ActNext and ActLast set their Content property values to First Previous Next and Last respectively. 2. Double-click the ActFirst button control. When the event handler appears add the following code ----- Move to the first record in the table. System.Windows.Data.CollectionViewSource catalogSource System.Windows.Data.CollectionViewSource this.FindResource courseCatalogViewSource catalogSource.View.MoveCurrentToFirst 3. Back on the window design surface double-click the ActPrevious button control. When the event handler appears add the following code ----- Move to the previous record in the table. System.Windows.Data.CollectionViewSource catalogSource System.Windows.Data.CollectionViewSource this.FindResource courseCatalogViewSource if catalogSource.View.CurrentPosition 0 catalogSource.View.MoveCurrentToPrevious 358 Microsoft ADO.NET 4 Step by Step 4. Back on the window design surface double-click the ActNext button control. When the event handler appears add the following code ---- Move to the next record in the table. System.Windows.Data.CollectionViewSource catalogSource System.Windows.Data.CollectionViewSource this.FindResource courseCatalogViewSource catalogSource.View.MoveCurrentToNext if catalogSource.View.IsCurrentAfterLast catalogSource.View.MoveCurrentToPrevious 5. Back on the window design surface double-click the