Đang chuẩn bị liên kết để tải về tài liệu:
Apress Introducing dot NET 4 0 with Visual Studio 2010_8
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
loại hình này của tính năng có thể rất hữu ích một cách nhanh chóng đặt lại với nhau các hình thức nhập dữ liệu đơn giản và các ứng dụng tạo mẫu. VS2010 có các chức năng mới để dễ dàng tạo ra các dữ liệu hình thức và tạo ra một số XAML đẹp, sạch sẽ. | CHAPTER 15 WPF 4.0 AND SILVERLIGHT 3.0 Figure 15-8. Improved error handling for user controls Static Resource and Designer Fix Previously if a static resource was declared in app.xaml you could not use it in the designer. In VS2010 you can. Drag-and-Drop Data Binding I m not a big fan of drag-and-drop data binding and I think it s fair to say that most programmers will rightly scorn such functionality. However this type of feature can be very useful for quickly putting together simple data entry forms and prototyping applications. VS2010 includes new functionality to easily create data forms and creates some pretty clean XAML. It seems likely that Microsoft might have brought in this feature to encourage some winforms developers to move over. You will now learn about this feature by creating a simple master detail form. 1. Select Data Show Data Sources. 2. Click the Add New Data Source button on the Data Sources window and the Choose a Data Source Type window will appear see Figure 15-9 . 372 CHAPTER 15 WPF 4.0 AND SILVERLIGHT 3.0 Figure 15-9. Choose a Data Source Type dialog 3. Select Database and then click Next. The Choose a Database Model screen will appear see Figure 15-10 . Figure 15-10. Choose a Database Model dialog 4. Select Dataset you could also use an entity data model for this feature and then click Next. 373 CHAPTER 15 WPF 4.0 AND SILVERLIGHT 3.0 5. In the next screen select the connection to the example database connection or create it if you haven t already and then click Next. 6. A new screen similar to Figure 15-11 will now appear allowing you to select the objects you want to use. Figure 15-11. Choose your poison sorry database objects 7. Select the Tables node to select all the tables and change the dataset name to Chapter15Dataset before clicking Finish. 8. You now have the data source set up and if you look over to the Data Sources window see Figure 15-12 you will see all the tables and their fields. Figure 15-12. Data Sources window after .