Recently, I was not very busy. I came to learn something. I saw a lot of friends on the Internet studying WPF, and I also came to give myself a chance,
Put your ownArticleWrite it down, hoping to help 0.1% beginners, so I will not be able to write it in white, and my ability to express myself is limited.
I don't want to talk too much about text. I generally like simple text, but it's okay to be clear and clear.
1. Introduction to The ListBox control
ListBox: It is basically the same as in winform. Here, it has many more attributes;
Ii. View running results
ProgramInitial page of Running
Click ">" to add the item to the listbox2 page.
Add a value to listbox1
III,Code
1) Add a value to ListBox when the form is loaded
Private VoidWindow_loaded (ObjectSender, routedeventargs E)
{
Listbox1.items. Add ("2. U.");
Listbox1.items. Add ("2. U. U.");
Listbox1.items. Add ("2. ü úzomä¶ × ó ×ó");
}
2) Add the value of listbox1 to listbox2
Private VoidButton#click (ObjectSender, routedeventargs e ){Try{Listbox2.items. Add (listbox1.selecteditem. tostring (); listbox1.items. Remove (listbox1.selecteditem. tostring ());}Catch(Exception ex) {MessageBox. Show (ex. tostring ());}}
3) dynamically add values to listbox1
Private VoidBntadd_click (ObjectSender, routedeventargs e) {listbox1.items. Add (textbox1.text. tostring (); textbox1.text =String. Empty ;}
4) Add the value of listbox2 to listbox1
Private VoidButton2_click (ObjectSender, routedeventargs e ){Try{Listbox1.items. Add (listbox2.selecteditem. tostring (); listbox2.items. Remove (listbox2.selecteditem. tostring ());}Catch(Exception ex) {MessageBox. Show (ex. Message. tostring ());}}
The above is a simple example, which is as simple as I can't talk about it. I hope that a beginner will have an entry, and I will also have an entry.
I hope you will give me your valuable comments and correct me!