This article is a summary of records, knowledge points will be relatively messy.
1. About the application of Sqllite database
For more information on how to set up Visual Studio 2013 to make the Sqllite database available, see http://www.cnblogs.com/tiny-home/p/4474861.html. I mainly share the problems and gains I encountered during my use of sqllite.
The first thing to do is to create a class that represents the record represented in the Sqllite database, which is equivalent to the CREATE statement in the normal database, which defines how many columns each record has in the table, what type of each column is, and each record is an object. Like what:
usingSQLite;usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespacenote.model{ Public classNotes:modelbase {Private intID; [AutoIncrement, PrimaryKey]//primary KEY and self-increment Public intID {Get; Set; } Private stringname; [MaxLength ( +)] Public stringName {Get{returnname;} Set { This. SetProperty (ref This. Name, value); } } Private stringContent//= DateTime.Now.ToString ();[MaxLength ( the)] Public stringContent {Get{returncontent;} Set { This. SetProperty (ref This. Content, value); } } Private BOOLisimportant; Public BOOLIsimportant {Get{returnIsimportant;} Set { This. SetProperty (ref This. isimportant, value); } } }}
This is similar to the normal class declaration, where the brackets are the limit for each attribute (column). There is one detail that may need to be noted when you use Visual Studio 2013 to develop WP8.1, when you change the definition of the data table (that is, change the Class), you need to restart the virtual machine, otherwise there will be an error.
Add Record:
Public Async void Add notes note// Add notes { = getconn (); await Conn. Insertasync (note);}
Find records:
Sqliteasyncconnection conn = Getconn ();
var from in Conn. Table<notes>() where note.id = = IDSelect Note;
To delete a record:
Public Async voidDelete (intId//Delete Notes{Sqliteasyncconnection conn=Getconn (); varquery = fromNoteinchConn. Table<notes>() whereNote.id = =IDSelectNote; Notes Notes=awaitquery. Firstordefaultasync (); awaitConn. Deleteasync (Notes); }
2. About the binding of data
{Binding} indicates data binding to the previous layer
{Binding MyProperty} indicates a specific property binding to the object bound by the previous layer
{Binding Object.myproperty} represents a specific property binding to a particular object and is no longer related to the content bound at the previous level
In addition {Binding * * *} has a property "Mode", such as can be written: text= "{Binding notedemo.content, Mode=twoway}"
Indicates that text is bound to notedemo.content and is bidirectional, meaning that when the notedemo.conten in the background changes, the value in text will change. And when you change the value of text, the Notedemo.conten in the background will change as well. This property in the two-volume binding will be a bit very convenient, you do not have to think about to save a temporary amount, two-way binding is equivalent to automatically save.
3. Use of RadioButton
RadioButton is the selection box control, which determines whether an item is selected. Such as:
<radiobutton content= "Important"
Ischecked= "{Binding Notedemo.isimportant,mode=twoway}"
Height= "69"
Width= "213"
Fontsize= "/>"
Content: Refers to the text of the prompt after selection
IsChecked: If the selection box is selected, here I bind it to notedemo.isimportant, which is a bool type variable
Height, Width: length and width
FontSize: Size of selection box
C # Learning (ix)-some of the gains from WP8.1 development