WPF: Working with Data

612 views

Published on

Set how to retrieve data from a SQL Server database, create common data bound forms and see how to display information from main and related tables.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
612
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • DEMO: rest of section\n
  • DEMO: rest of section\n
  • DEMO: rest of section\n
  • DEMO: rest of section\n
  • DEMO: rest of section\n
  • DEMO: rest of section\n
  • WPF: Working with Data

    1. 1. WPF: Working With Data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    2. 2. Objectives Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    3. 3. Objectives• Set how to retrieve data from a SQL Server database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    4. 4. Objectives• Set how to retrieve data from a SQL Server database• Create common data bound forms Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    5. 5. Objectives• Set how to retrieve data from a SQL Server database• Create common data bound forms• See how to display information from main and related tables Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    6. 6. Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    7. 7. Agenda• Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    8. 8. Agenda• Data Binding• Using Views Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    9. 9. Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    10. 10. Data Binding• Process of getting information from one object to another and automatically displaying it in one or more elements in user interface Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    11. 11. Without Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    12. 12. Without Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    13. 13. Without Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers2. In code or in XAML, set ItemsSource property of list box to DataTable or other object that contains customers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    14. 14. Without Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers2. In code or in XAML, set ItemsSource property of list box to DataTable or other object that contains customers3. In list box’s SelectionChanged event handler, query database and retrieve information for selected customer Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    15. 15. Without Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    16. 16. Without Data Binding4. In list box’s SelectionChanged event handler, set Text property of each text box to value of appropriate column of customer data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    17. 17. Without Data Binding4. In list box’s SelectionChanged event handler, set Text property of each text box to value of appropriate column of customer data5. In Save button’s Click event handler, read value of each text box and update appropriate column of customer data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    18. 18. Without Data Binding4. In list box’s SelectionChanged event handler, set Text property of each text box to value of appropriate column of customer data5. In Save button’s Click event handler, read value of each text box and update appropriate column of customer data6. In Save button’s Click event handler, save changes http://www.learnnowonline.com Learn More @ back to database Copyright © by Application Developers Training Company
    19. 19. With Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    20. 20. With Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    21. 21. With Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers2. In code or in XAML, set ItemsSource property of list box to DataTable or other object that contains customers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    22. 22. With Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers2. In code or in XAML, set ItemsSource property of list box to DataTable or other object that contains customers3. In list box’s SelectionChanged event handler, query database and retrieve information for selected customer Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    23. 23. With Data Binding1. In window’s Loaded event handler, query database and retrieve list of customers2. In code or in XAML, set ItemsSource property of list box to DataTable or other object that contains customers3. In list box’s SelectionChanged event handler, query database and retrieve information for selected customer4. In Save button’s Click event handler, save changes back to database Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    24. 24. Data Source Options Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    25. 25. Data Source Options• Same as in Windows Forms applications Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    26. 26. Data Source Options• Same as in Windows Forms applications• Many data sources Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    27. 27. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    28. 28. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects • ADO.NET DataSets Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    29. 29. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects • ADO.NET DataSets • LINQ to SQL Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    30. 30. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects • ADO.NET DataSets • LINQ to SQL • Entity Framework Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    31. 31. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects • ADO.NET DataSets • LINQ to SQL • Entity Framework • Services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    32. 32. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects • ADO.NET DataSets • LINQ to SQL • Entity Framework • Services • Web services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    33. 33. Data Source Options• Same as in Windows Forms applications• Many data sources • Custom business objects • ADO.NET DataSets • LINQ to SQL • Entity Framework • Services • Web services • Windows Communication Foundation (WCF) services Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    34. 34. Binding to an Object Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    35. 35. Binding to an Object• Display clients in a list box • Create collection of clients in code • Populate the collection • Bind to object in XAML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    36. 36. Binding to an Object• Display clients in a list box • Create collection of clients in code • Populate the collection • Bind to object in XAML Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    37. 37. Binding to an Object• Display clients in a list box • Create collection of clients in code • Populate the collection • Bind to object in XAML<ListBox Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    38. 38. Binding to an Object• Display clients in a list box • Create collection of clients in code • Populate the collection • Bind to object in XAML<ListBox Name="listBox1" Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    39. 39. Binding to an Object• Display clients in a list box • Create collection of clients in code • Populate the collection • Bind to object in XAML<ListBox Name="listBox1" DisplayMemberPath="Name" ItemsSource= Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    40. 40. Binding to an Object• Display clients in a list box • Create collection of clients in code • Populate the collection • Bind to object in XAML<ListBox Name="listBox1" DisplayMemberPath="Name" ItemsSource= "{Binding ElementName=bindingToObject, Path=Clients}" /> Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    41. 41. Binding to an Object Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    42. 42. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    43. 43. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    44. 44. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding<Grid Grid.Row="1" DataContext= Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    45. 45. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding<Grid Grid.Row="1" DataContext= "{Binding ElementName=listBox1, Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    46. 46. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding<Grid Grid.Row="1" DataContext= "{Binding ElementName=listBox1, Path=SelectedItem}" > Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    47. 47. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding<Grid Grid.Row="1" DataContext= "{Binding ElementName=listBox1, Path=SelectedItem}" ><TextBox Text="{Binding Path=Name}" Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    48. 48. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding<Grid Grid.Row="1" DataContext= "{Binding ElementName=listBox1, Path=SelectedItem}" ><TextBox Text="{Binding Path=Name}" Grid.Row="0" Grid.Column="1" Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    49. 49. Binding to an Object• Select a client and display details in data- bound text boxes in a grid • Bind grid by setting data context to selected list box item • Text boxes in grid inherit data binding<Grid Grid.Row="1" DataContext= "{Binding ElementName=listBox1, Path=SelectedItem}" ><TextBox Text="{Binding Path=Name}" Grid.Row="0" Grid.Column="1" Margin="5,5,10,5" MaxHeight="25" /> Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    50. 50. Binding to a DataTable Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    51. 51. Binding to a DataTable• Display customers in a list box and details for selected customer in text boxes in grid Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    52. 52. Binding to a DataTable• Display customers in a list box and details for selected customer in text boxes in grid • Use TableAdapter or intermediary data layer to retrieve customers and store in DataTable Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    53. 53. Binding to a DataTable• Display customers in a list box and details for selected customer in text boxes in grid • Use TableAdapter or intermediary data layer to retrieve customers and store in DataTable • Set ItemsSource property of list box to Customers table Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    54. 54. Binding to a DataTable• Display customers in a list box and details for selected customer in text boxes in grid • Use TableAdapter or intermediary data layer to retrieve customers and store in DataTable • Set ItemsSource property of list box to Customers table • Grid data context is set to list box selected item Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    55. 55. Binding to a DataTable• Display customers in a list box and details for selected customer in text boxes in grid • Use TableAdapter or intermediary data layer to retrieve customers and store in DataTable • Set ItemsSource property of list box to Customers table • Grid data context is set to list box selected item • Text boxes automatically update when a customer is selected Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    56. 56. Binding to a DataTable• Display customers in a list box and details for selected customer in text boxes in grid • Use TableAdapter or intermediary data layer to retrieve customers and store in DataTable • Set ItemsSource property of list box to Customers table • Grid data context is set to list box selected item • Text boxes automatically update when a customer is selected • List box SelectionChanged event handler runs Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    57. 57. Binding to a LINQ Query Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    58. 58. Binding to a LINQ Query• Display customers in a list box and details for selected customer in text boxes in grid Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    59. 59. Binding to a LINQ Query• Display customers in a list box and details for selected customer in text boxes in grid • Run LINQ to SQL query to retrieve customers Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    60. 60. Binding to a LINQ Query• Display customers in a list box and details for selected customer in text boxes in grid • Run LINQ to SQL query to retrieve customers • Set ItemsSource property of results of query Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    61. 61. Binding to a LINQ Query• Display customers in a list box and details for selected customer in text boxes in grid • Run LINQ to SQL query to retrieve customers • Set ItemsSource property of results of query • Grid data context is set to list box selected item Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    62. 62. Binding to a LINQ Query• Display customers in a list box and details for selected customer in text boxes in grid • Run LINQ to SQL query to retrieve customers • Set ItemsSource property of results of query • Grid data context is set to list box selected item • Text boxes automatically update when a Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    63. 63. Binding to One Row of Data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    64. 64. Binding to One Row of Data• Display information on a product when user enters product id and clicks Find button Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    65. 65. Binding to One Row of Data• Display information on a product when user enters product id and clicks Find button • Use TableAdapter or LINQ to SQL query to retrieve information on a product Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    66. 66. Binding to One Row of Data• Display information on a product when user enters product id and clicks Find button • Use TableAdapter or LINQ to SQL query to retrieve information on a product • Set data context of grid to row in DataTable or result of LINQ query Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    67. 67. Demos Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    68. 68. Demos• Binding to an Object Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    69. 69. Demos• Binding to an Object• Binding to a DataTable Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    70. 70. Demos• Binding to an Object• Binding to a DataTable• Binding to a LINQ Query Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    71. 71. Demos• Binding to an Object• Binding to a DataTable• Binding to a LINQ Query• Binding to One Row of Data Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    72. 72. Agenda Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    73. 73. Agenda• Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    74. 74. Agenda• Data Binding• Using Views Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    75. 75. Using Views Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    76. 76. Using Views• When you bind to a collection, WPF creates a collection view Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    77. 77. Using Views• When you bind to a collection, WPF creates a collection view • View manages currency (position of current item) Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    78. 78. Using Views• When you bind to a collection, WPF creates a collection view • View manages currency (position of current item) • Use view to navigate, sort, filter, group Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    79. 79. Using Views• When you bind to a collection, WPF creates a collection view • View manages currency (position of current item) • Use view to navigate, sort, filter, group• In code, use instance of CollectionView class Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    80. 80. Using Views• When you bind to a collection, WPF creates a collection view • View manages currency (position of current item) • Use view to navigate, sort, filter, group• In code, use instance of CollectionView class• To get reference to CollectionView, call GetDefaultView method of Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    81. 81. CollectionView Class Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    82. 82. CollectionView Class• Navigation Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    83. 83. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    84. 84. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast • Properties: CurrentItem, CurrentPosition Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    85. 85. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast • Properties: CurrentItem, CurrentPosition• Sorting Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    86. 86. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast • Properties: CurrentItem, CurrentPosition• Sorting • SortDescriptions property contains collection of SortDescription structures Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    87. 87. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast • Properties: CurrentItem, CurrentPosition• Sorting • SortDescriptions property contains collection of SortDescription structures • SortDescription specifies column to sort on and order Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    88. 88. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast • Properties: CurrentItem, CurrentPosition• Sorting • SortDescriptions property contains collection of SortDescription structures • SortDescription specifies column to sort on and order • SortDescriptions.Add adds a sorting order Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    89. 89. CollectionView Class• Navigation • Methods: MoveCurrentToFirst, MoveCurrentToPrevious, MoveCurrentToNext, MoveCurrentToLast • Properties: CurrentItem, CurrentPosition• Sorting • SortDescriptions property contains collection of SortDescription structures • SortDescription specifies column to sort on and order • SortDescriptions.Add adds a sorting order • SortDescriptions.Clear clears sorting Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    90. 90. CollectionView Class Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    91. 91. CollectionView Class• Filtering Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    92. 92. CollectionView Class• Filtering • Cast view to BindingListCollection Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    93. 93. CollectionView Class• Filtering • Cast view to BindingListCollection • Set CustomFilter property of BindingListCollection to filter expression Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    94. 94. CollectionView Class• Filtering • Cast view to BindingListCollection • Set CustomFilter property of BindingListCollection to filter expression • Set CustomFilter to empty string to clear filter Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    95. 95. CollectionViewSource Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    96. 96. CollectionViewSource• XAML representation of view Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    97. 97. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    98. 98. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    99. 99. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    100. 100. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    101. 101. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    102. 102. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> <CollectionViewSource Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    103. 103. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> <CollectionViewSource x:Key="customersViewSource" Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    104. 104. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> <CollectionViewSource x:Key="customersViewSource" Source="{Binding Path=Customers, Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    105. 105. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> <CollectionViewSource x:Key="customersViewSource" Source="{Binding Path=Customers, Source={StaticResource Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    106. 106. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> <CollectionViewSource x:Key="customersViewSource" Source="{Binding Path=Customers, Source={StaticResource northwindDataSet}}" /> Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    107. 107. CollectionViewSource• XAML representation of view• Can define views in XAML rather than in code<Window.Resources> <local:NorthwindDataSet x:Key="northwindDataSet" /> <CollectionViewSource x:Key="customersViewSource" Source="{Binding Path=Customers, Source={StaticResource northwindDataSet}}" /></Window.Resources> Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    108. 108. Demos Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    109. 109. Demos• Using a CollectionView Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    110. 110. Demos• Using a CollectionView• Using a CollectionViewSource Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    111. 111. Drag and Drop Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    112. 112. Drag and Drop Data Binding• Drag and drop data binding supported in Windows Forms since Visual Studio 2005 Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    113. 113. Drag and Drop Data Binding• Drag and drop data binding supported in Windows Forms since Visual Studio 2005• Now supported in WPF Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    114. 114. Drag and Drop Data Binding• Drag and drop data binding supported in Windows Forms since Visual Studio 2005• Now supported in WPF• Visual Studio creates CollectionViewSources in XAML when you drag data onto a window Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    115. 115. Drag and Drop Data Binding• Drag and drop data binding supported in Windows Forms since Visual Studio 2005• Now supported in WPF• Visual Studio creates CollectionViewSources in XAML when you drag data onto a window• One-to-many relationships automatically handled Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    116. 116. Demo Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    117. 117. Demo• Drag and Drop Data Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    118. 118. Learn More! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    119. 119. Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    120. 120. Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details! Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    121. 121. Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details!• Learn more about WPF on SlideShare: Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    122. 122. Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details!• Learn more about WPF on SlideShare:  Intro to Windows Presentation Foundation (WPF) Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    123. 123. Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details!• Learn more about WPF on SlideShare:  Intro to Windows Presentation Foundation (WPF)  WPF: Advanced Controls Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company
    124. 124. Learn More!• This is an excerpt from a larger course. Visit www.learnnowonline.com for the full details!• Learn more about WPF on SlideShare:  Intro to Windows Presentation Foundation (WPF)  WPF: Advanced Controls  WPF: Binding Learn More @ http://www.learnnowonline.com Copyright © by Application Developers Training Company

    ×