(1) Processing strings
(2) Use datetime
(3) Understanding and creating classes
This section describes how to create a class, how to instantiate a class, and how to call the class members. This part is completely in C. This part of content has been quite familiar to me, so there is nothing to gain. But I found a quick technology. This is called code snippet plus auto implemented property technology, which can quickly input code and greatly improve efficiency.
Relevant content can refer to this article blog: http://www.cnblogs.com/Xiaojiang/archive/2008/04/05/1138333.html describes in detail several shortcut keys.
This section uses prop to quickly create the member attributes of the class by entering prop and double-clicking the tab key:
When the cursor is not removed, you can switch the int and myproperty codes by pressing the tab to enter the type and name of the variable you want to create, double-click Enter to switch to the next line.
(4) use the class in the. NET Framework class library
This section describes how to use the class definition instance in the. NET Framework class library. Instances are not only new, but also in other ways, such as isolatedstoragesetpolicmysettings = isolatedstoragesettings. applicationsettings; this is an instance of isolatedstoragesettings created by coreclr when the siliverlight application is executed by Windows Phone. We can reference the isolatedstoragesettings object by accessing its applicationsettings attribute.
For how to differentiate and use classes in the. NET Framework class library, we can open the msdn.micorsoft.com website to help us solve the problem. You can also query websites, forums, books, and videos.
It turns out that the more code you write, the more experience you can use for reference.
In fact, when we drag a control to the settings interface, we have created an instance for this control. In XAML, a corresponding code is also created, like XML or HTML.
When creating a button, you can use the new operator of C # Or create it in The XAML code.
(5) Understand namespaces
This section mainly introduces the namespace, which is both a "namespace" and a "namespace".. net. net. When referencing a class, we must include the class namespace using in the header. By referencing this class name, we can write the namespace together without writing it. If the corresponding namespace is not referenced when the class is used, an error is reported. For example:
Sqlconnection
If there is no using corresponding namespace at the beginning, an error will be prompted:
The red wavy line indicates that vs cannot recognize this class, and the blue line indicates that the namespace containing this class can be found in the library. At this time, you only need to press Ctrl +. The following will appear:
Press enter to automatically add a namespace.
(6) use a set
This section describes how to create a collection of objects.
List<int> list = new List<int>();list.Add(2);list.Add(3);list.Add(7);foreach (int prime in list) // Loop through List with foreach{Console.WriteLine(prime);}for (int i = 0; i < list.Count; i++) // Loop through List with for{Console.WriteLine(list[i]);}
~~~ Output of the program ~~~
(Repeated twice)
2
3
7
Related usage, refer to this blog: http://www.cnblogs.com/wangs/archive/2011/01/19/1939006.html
(7) object and set initial values
This section describes two methods to initialize an object. One is to assign a value to an instance when creating an instance, and the other is to assign a value to an object when creating an object set.
For example:
Car car1 = new car () {make = "Japan", model = "Honda "};
Car car2 = new car () {make = "Germany", model = "Toyota "};
List <car> Carlist = new list <car> (){
New car () {make = "Japan", model = "Honda "},
New car () {make = "Germany", model = "Toyota "}
};
Foreach (CAR mycar in Carlist)
{
Mytextblock. Text + = mycar. Make + ":" + mycar. Model + environment. newline;
}
Indeed, assigning values when creating a set can simplify a lot of code and use a set, greatly facilitating batch output.
(8) work in The XAML designer and code window
This section describes the function buttons in the window. Then explains how to use code to create a button in the XAML window. That is to say, the content of the XAML and the visual window is synchronized. In The XAML, you can also create various controls by writing code, and sometimes writing code is more efficient than dragging the control.
(9) Understand The XAML syntax
This section describes the syntax of XAML. In essence, XAML is a programming language designed for the uidesigner. It focuses on the design and layout of Silverlight, just like XML and HTML, and separates logical design from uidesign. Most developers choose expression blend for Windows Phone 7 because it provides additional tools and functions to better set the interface and enhance the user experience, visual Studio 2010 express for Windows Phone focuses more on Writing C # code.
<Phone: phoneapplicationpage X: class = "phoneapp4.mainpage" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns: Phone = "CLR-namespace: Microsoft. phone. controls; Assembly = Microsoft. phone "xmlns: shell =" CLR-namespace: Microsoft. phone. shell; Assembly = Microsoft. phone "xmlns: D =" http://schemas.microsoft.com/expression/blend/2008 "xmlns: MC = "Http://schemas.openxmlformats.org/markup-compatibility/2006" MC: ignorable = "D" D: designwidth = "480" D: designheight = "768" fontfamily = "{staticresource quota}" fontsize = "{staticresource quota}" foreground = "{staticresource quota}" supportedorientations = "portrait" orientation = "portrait" Shell: systemtray. isvisible = "true"> <! -- Layoutroot is the root resource for storing all the faces --> <grid X: Name = "layoutroot" background = "Transparent"> <grid. rowdefinitions> <rowdefinition Height = "Auto"/> <rowdefinition Height = "*"/> </grid. rowdefinitions> <! -- Titlepanel contains the application's name, question, and question --> <stackpanel X: Name = "titlepanel" grid. row = "0" margin = ","> <textblock X: name = "applicationtitle" text = "my application" style = "{staticresource phonetextnormalstyle}"/> <textblock X: name = "pagetitle" text = "subtitle" margin = "9,-, 0" style = "{staticresource phonetexttitle1style}"/> </stackpanel> <! -- Contentpanel-other content here --> <grid X: Name = "contentpanel" grid. row = "1" margin = "12, 0, 12, 0"> <button content = "button" Height = "72" horizontalalignment = "Left" margin = "134,48, 160 "name =" button1 "verticalignment =" TOP "width =" "/> </GRID> <! -- Example of how to use the ApplicationBar --> <! -- <Phone: phoneapplicationpage. applicationBar> <shell: ApplicationBar isvisible = "true" ismenuenabled = "true"> <shell: applicationbariconbutton iconuri = "/images/appbar_button1.png" text = "Press limit 1"/> <shell: applicationbariconbutton iconuri = "/images/appbar_button2.png" text = "Press limit 2"/> <shell: ApplicationBar. menuitems> <shell: applicationbarmenuitem text = "1"/> <shell: applicationbarmenuitem text =" 2"/> </shell: ApplicationBar. menuitems> </shell: ApplicationBar> </Phone: phoneapplicationpage. applicationBar> --> </Phone: phoneapplicationpage>
<Phone: phoneapplicationpage
The beginning of all content, and all content is included in it. Phoneapplicationpage is a namespace with phone as its alias
Xmlns: Phone = "CLR-namespace: Microsoft. Phone. controls; Assembly = Microsoft. Phone"
Namespace: Phone is from CLR-namespace: Microsoft. Phone. controls; Assembly = Microsoft. Phone. So all the words above with: are actually defining namespaces, just like using in C.
<! -- Code comment -->
This is used for annotation, like HTML.
<! -- Layoutroot is the root resource for storing all the faces -->
<Grid X: Name = "layoutroot" background = "Transparent">
The grid here is the grid used for layout.
<! -- Titlepanel contains the application's name and question mark -->
<Stackpanel X: Name = "titlepanel" grid. Row = "0" margin = ",">
This is the Panel corresponding to the first row of the grid. Is the container
Grid and panel are the main technologies used to layout controls and text on Windows Phone Silverlight applications.
<! -- Titlepanel contains the application's name and question mark -->
<Stackpanel X: Name = "titlepanel" grid. Row = "0" margin = ",">
<Textblock X: Name = "applicationtitle" text = "my application" style = "{staticresource phonetextnormalstyle}"/>
<Textblock X: Name = "pagetitle" text = "" "margin =" 9,-, 0 "style =" {staticresource phonetexttitle1style} "/>
</Stackpanel>
The stackpanel contains two textblock controls. This stackpanel is usually used to define the topic of an application.
<! -- Contentpanel-other content here -->
<Grid X: Name = "contentpanel" grid. Row = "1" margin = "12,0, 12,0">
<Button content = "button" Height = "72" horizontalalignment = "Left" margin = "134,48, 160 "name =" button1 "verticalignment =" TOP "width =" "/>
</GRID>
It is mainly used to place the control content that defines the main functions of the program.
<! -- Example of how to use the ApplicationBar -->
<! -- <Phone: phoneapplicationpage. ApplicationBar>
<Shell: ApplicationBar isvisible = "true" ismenuenabled = "true">
<Shell: applicationbariconbutton iconuri = "/images/appbar_button1.png" text = "Press limit 1"/>
<Shell: applicationbariconbutton iconuri = "/images/appbar_button2.png" text = "Press limit 2"/>
<Shell: ApplicationBar. menuitems>
<Shell: applicationbarmenuitem text = "1"/>
<Shell: applicationbarmenuitem text = "2"/>
</Shell: ApplicationBar. menuitems>
</Shell: ApplicationBar>
</Phone: phoneapplicationpage. ApplicationBar> -->
The commented content is used for future extension and is used to define functions such as the menu bar.
(10) Silverlight layout Control
This section describes three controls for layout: grid, canvas, and stackpanel.
(11) Handling Silverlight events
(12) Silverlight input control
(13) homework the next day
(14) homework solution for the next day-Part 1
(15) homework solution for the next day-Part 1