Académique Documents
Professionnel Documents
Culture Documents
Table of Contents
vi
Table of Contents
vii
Table of Contents
Chapter 3: Flow Control and Exception Handling in C# 5.0 Programs ................................. 119
In Depth........................................................................................................................................................... 120
Control Flow Statements ................................................................................................................................. 120
Selection Statements .................................................................................................................................. 120
Iteration Statements or Loops ................................................................................................................... 122
Jump Statements ........................................................................................................................................ 124
Exception Handling......................................................................................................................................... 126
The trycatchfinally Statement............................................................................................................ 127
The throw Statement ................................................................................................................................. 128
Checked and Unchecked Statements.............................................................................................................. 128
Immediate Solutions ...................................................................................................................................... 129
Using the if Statement ..................................................................................................................................... 129
Using Nested if Statements ............................................................................................................................. 129
Using the switch Statement............................................................................................................................. 130
Using Fall-through Switch Statement............................................................................................................. 132
Using the while Loop ...................................................................................................................................... 133
Using the dowhile Loop .............................................................................................................................. 134
Using the for Loop........................................................................................................................................... 135
viii
Table of Contents
ix
Table of Contents
Table of Contents
xi
Table of Contents
Chapter 7: Dynamic Data Type and Dynamic Language Runtime (DLR) .............................. 255
In Depth........................................................................................................................................................... 256
Understanding the Dynamic Data Type ........................................................................................................ 256
Converting the Data Types ............................................................................................................................. 257
Exploring Dynamic Language Runtime ......................................................................................................... 258
Advantages of DLR ................................................................................................................................... 258
Architecture of DLR .................................................................................................................................. 259
Understanding the ExpandoObject and DynamicObject Classes ................................................................. 260
Immediate Solutions ...................................................................................................................................... 261
Using Dynamic Data Type .............................................................................................................................. 261
Converting Data Types ................................................................................................................................... 262
Using the ExpandoObject Class ...................................................................................................................... 263
Using the DynamicObject Class...................................................................................................................... 264
Summary.......................................................................................................................................................... 266
xii
Table of Contents
xiii
Table of Contents
xiv
Table of Contents
xv
Table of Contents
xvi
Table of Contents
xvii
Table of Contents
xviii
Table of Contents
Chapter 13: Login and Web Parts Controls in ASP.NET 4.5.................................................. 561
In Depth........................................................................................................................................................... 562
Introducing Login Controls ............................................................................................................................ 562
The Login Control ..................................................................................................................................... 563
The LoginView Control............................................................................................................................. 565
The LoginName Control ........................................................................................................................... 567
The LoginStatus Control ........................................................................................................................... 567
The PasswordRecovery Control ............................................................................................................... 569
The ChangePassword Control .................................................................................................................. 571
The CreateUserWizard Control ................................................................................................................ 575
Introducing Web Parts Controls ..................................................................................................................... 579
The WebPartManager Control .................................................................................................................. 579
The ProxyWebPartManager Control ........................................................................................................ 588
The WebPartZone Control ........................................................................................................................ 589
The CatalogZone Control.......................................................................................................................... 592
The DeclarativeCatalogPart Control......................................................................................................... 593
The PageCatalogPart Control ................................................................................................................... 595
The ImportCatalogPart Control ................................................................................................................ 596
The EditorZone Control ............................................................................................................................ 598
The LayoutEditorPart Control .................................................................................................................. 600
The AppearanceEditorPart Control .......................................................................................................... 602
The PropertyGridEditorPart Control........................................................................................................ 603
The BehaviorEditorPart Control ............................................................................................................... 604
The ConnectionsZone Control .................................................................................................................. 606
Immediate Solutions ...................................................................................................................................... 609
Using the Login and LoginView Controls...................................................................................................... 609
Using the LoginName and LoginStatus Controls .......................................................................................... 615
Using the CreateUserWizard Control ............................................................................................................ 617
Using the PasswordRecovery and ChangePassword Controls ..................................................................... 619
Creating the WebPartManager Control in Code............................................................................................ 625
Creating the WebPartZone Control in Code .................................................................................................. 627
xix
Table of Contents
Chapter 14: Enhancing Web Applications with Silverlight 5.0 .............................................. 637
In Depth........................................................................................................................................................... 638
Main Features of Silverlight ............................................................................................................................ 638
Improved Programming Model................................................................................................................ 639
Comprehensive UI Framework ................................................................................................................ 639
Support for Deep Zoom Technology ........................................................................................................ 639
Support for 2-D Graphics, Animations, and Multimedia ........................................................................ 639
Support for Networking............................................................................................................................ 640
Support for Higher Quality Video and Audio ......................................................................................... 640
Empowering Richer Experiences .............................................................................................................. 640
Improving Rich Internet Application Productivity ................................................................................. 641
Enhanced Data Support ............................................................................................................................ 641
Improved Performance ............................................................................................................................. 641
Out of Browser Capabilities ...................................................................................................................... 642
New Features of Silverlight 5.0 ....................................................................................................................... 642
Enhancements in Controls ........................................................................................................................ 642
Enhancements in Media ............................................................................................................................ 642
Enhancements in Graphics........................................................................................................................ 643
Enhancements in Text ............................................................................................................................... 643
Enhancements in Trusted Applications ................................................................................................... 643
Enhancements in Printing ......................................................................................................................... 643
Enhancements in User Interface ............................................................................................................... 643
Enhancements in Data Binding................................................................................................................. 644
Enhancements in XAML ........................................................................................................................... 644
Improvements in Performance ................................................................................................................. 644
Architecture of Silverlight ............................................................................................................................... 644
The .NET Framework for Silverlight ........................................................................................................ 645
The Core Presentation Framework ........................................................................................................... 645
Silverlight Applications in Visual Studio 2012............................................................................................... 646
Assemblies and Files in Silverlight Applications..................................................................................... 648
Controls in Silverlight Applications ......................................................................................................... 656
Silverlight and ASP.NET ................................................................................................................................. 671
Data Binding in Silverlight.............................................................................................................................. 673
Types of Data Binding in Silverlight ........................................................................................................ 673
Binding Object ........................................................................................................................................... 674
Data Context .............................................................................................................................................. 674
xx
Table of Contents
Converters.................................................................................................................................................. 674
DataTemplate and ObservableCollection................................................................................................. 674
Data Binding Using Networking API....................................................................................................... 675
Immediate Solutions ...................................................................................................................................... 676
Creating a Simple Silverlight Application...................................................................................................... 676
Using Silverlight Controls............................................................................................................................... 678
Using the Calendar Control ...................................................................................................................... 678
Using the DatePicker Control ................................................................................................................... 685
Using the GridSplitter Control.................................................................................................................. 689
Using the HyperlinkButton Control ......................................................................................................... 691
Using the MediaElement Control ............................................................................................................. 693
Using the Popup Control .......................................................................................................................... 695
Using the TabControl Control .................................................................................................................. 699
Using the AutoCompleteBox Control....................................................................................................... 702
Using the DataPager Control .................................................................................................................... 705
Using the TreeView Control ..................................................................................................................... 707
Integrating Silverlight with ASP.NET Applications ...................................................................................... 709
Data Binding with Silverlight Application..................................................................................................... 710
Summary.......................................................................................................................................................... 716
xxi
Table of Contents
xxii
Table of Contents
xxiii
Table of Contents
xxiv
Table of Contents
xxv
Table of Contents
Chapter 21: Data Binding in Windows Forms and WPF Applications .................................. 949
In Depth........................................................................................................................................................... 950
Introducing Data Binding ............................................................................................................................... 950
Data Binding to Windows Forms Controls .................................................................................................... 951
Data Binding to WPF Controls........................................................................................................................ 951
Data Flow Directions in WPF.................................................................................................................... 951
Sources of Data Binding in WPF ............................................................................................................... 952
Different Ways of Data Binding in WPF .................................................................................................. 952
Data Binding in WPF Using WCF Data Services ........................................................................................... 953
Immediate Solutions ...................................................................................................................................... 954
Implementing Simple Data Binding in Windows Forms .............................................................................. 954
Implementing Complex Data Binding in Windows Forms ........................................................................... 958
Binding Windows Forms Controls ................................................................................................................. 959
Text Boxes and Labels ............................................................................................................................... 959
Check Boxes ............................................................................................................................................... 961
Combo Boxes ............................................................................................................................................. 963
List Boxes ................................................................................................................................................... 964
Checked List Boxes .................................................................................................................................... 965
MenuStrip and StatusStrip Controls......................................................................................................... 966
Using the BindingContext Class ..................................................................................................................... 968
Moving to the First Record........................................................................................................................ 970
Moving to the Previous Record ................................................................................................................ 970
Displaying the Next or Current Record ................................................................................................... 970
Moving to the Last Record ........................................................................................................................ 971
Using Parameterized SQL Queries ................................................................................................................. 971
Binding Data in WPF....................................................................................................................................... 972
Binding a CLR Object in WPF ......................................................................................................................... 974
Binding an ADO.NET Object in WPF............................................................................................................. 977
Binding an XML Object in WPF ...................................................................................................................... 978
Using the DependencyObject Constructor in WPF........................................................................................ 980
Binding a Web Service in WPF ....................................................................................................................... 981
Creating a WCF Data Service.......................................................................................................................... 985
Summary.......................................................................................................................................................... 988
xxvi
Table of Contents
xxvii
Table of Contents
xxviii
Table of Contents
xxix
Table of Contents
xxx
Table of Contents
xxxi
Table of Contents
xxxii
Table of Contents
xxxiii
Table of Contents
xxxiv