Mỗi đòi hỏi kiến thức miền khác nhau và kỹ năng lập trình khác nhau. WCF kết hợp tất cả các thành một mô hình lập trình duy nhất, làm giảm độ phức tạp tổng thể này và làm cho nó dễ dàng hơn cho các nhà phát triển để tập trung vào logic kinh doanh mà bạn đang trả tiền để sản xuất. | 200 CHAPTER 8 .NET WINDOWS PRESENTATION FOUNDATION 8. Select Address Array and click Finish. This sets the DataContext for the Grid and thus all its child controls to the set of addresses that are found in the XML file. 9. Next add a TextBox a Button and a ListBox to the window. You are going to set up the data binding for the ListBox. Select it and look at its common properties. You will see that its DataContext property has already been initialized because the control is on the Grid that had its DataContext set and the ListBox inherited this. You can of course override it and point to a different data source to get the context for this control but for now this is perfectly OK. 10. To bind the ListBox to the data source you use the ItemsSource property. Click it and select Data Binding in the ensuing dialog. 11. The Create Data Binding dialog will appear. This time you want to bind to the context that is already present so select the Explicit Data Context tab and pick your data source from there. If you don t see all the fields change the Show dropdown to All Properties see Figure 8-22 . Figure 8-22. Binding to the current DataContext CHAPTER 8 .NET WINDOWS PRESENTATION FOUNDATION 201 12. Select Address Array and click Define Data Template. This allows you to define which fields you want to appear in the list. If you only want one field you don t have to go this route just select it in the Create Data Binding dialog however data templates allow you more flexibility. 13. The Create Data Template dialog appears and gives you three options for how you want your data to appear Default ListBox Styling which gives you all the fields stuck together into a single text line with each entry having one line Current or Predefined Data Template which allows you to pick an existing data template and apply it to this ListBox and New Data Template and Display Fields which allows you to design a simple data template based on the fields that are currently available see .