Learning Language Integrated Query (LINQ) .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. 194
Querying Object Collections with LINQ .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. . 194
Creating a LINQ Projection with Anonymous Types .. . .. .. . .. .. . .. .. . .. .. . .. . 198
Using LINQ to Sort Collection Results ... .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. 199
Handling Data with LINQ to SQL .................................................. 200
Setting Up LINQ to SQL ..................................................... 200
Working with the LINQ to SQL Designer . .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. . 201
Introduction to Querying LINQ to SQL .. .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. 203
Performing Queries on Multiple Tables .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . . 205
Inserting Data with LINQ to SQL ............................................. 210
Updating Data with LINQ to SQL ............................................ 211
Deleting Data with LINQ to SQL ............................................. 212
Summary ........................................................................... 214
PART III Building Programs with VS 2010
8 Building Desktop Applications with WPF .. .. .. . .. .. . .. .. . .. .. . .. .. . .. .. . . 217
Starting a WPF Project .............................................................. 218
Understanding Layout .............................................................. 220
Grid Layout .................................................................. 220
StackPanel Layout ............................................................ 222
DockPanel Layout ............................................................ 223
WrapPanel Layout ............................................................ 224
Canvas Layout ................................................................ 225
Using WPF Controls ................................................................ 226
Managing Windows for Controls .............................................. 226
Setting Properties ............................................................. 228
Handling Events .............................................................. 228
Coding Event Handlers ....................................................... 233
Working with Data in WPF ......................................................... 234
Setting Up a Data Source ..................................................... 235
Configuring a ComboBox ..................................................... 241
Reading and Saving Data ..................................................... 243
Using the DataGrid ........................................................... 244
Summary ........................................................................... 247
9 Creating Web Applications with ASP.NET MVC . . .. .. . .. .. . .. .. . .. .. . .. . 249
Understanding ASP.NET MVC ..................................................... 250
Starting an ASP.NET MVC Project ................................................. 251
Creating the Models ................................................................ 254
Building Controllers ................................................................ 254
Displaying Views ................................................................... 256
Looking Inside a View ........................................................ 256
Organizing View Files ........................................................ 258
Contents xiii