Tham khảo tài liệu 'www xddl info introducing dot net_8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 15 WPF AND SILVERLIGHT Figure 15-8. Improved error handling for user controls Static Resource and Designer Fix Previously if a static resource was declared in 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 AND SILVERLIGHT 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 AND SILVERLIGHT 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 .