8.Listpicker
When you click this control, a list will pop up. There are two types of lists, one is simple like the drop-down list box, and the other is full mode, A complete page list is displayed.
1. Simple list:
<toolkit:ListPicker Height="215" HorizontalAlignment="Left" Margin="86,67,0,0" Name="listPicker1" VerticalAlignment="Top" Width="283"> <sys:String>Red</sys:String> <sys:String>Green</sys:String> <sys:String>Blue</sys:String> </toolkit:ListPicker>
Selectionchanged: used to respond to the selected items in the list.
2. Full mode:
<Toolkit: listpicker itemssource = "{binding}" Height = "139" horizontalalignment = "Left" margin = "6,256, 444 "name =" listpicker2 "verticalignment =" TOP "width =" "header =" Test2 "fullmodeheader =" Colors "> <Toolkit: listpicker. itemtemplate> <! -- Display --> <datatemplate> <stackpanel orientation = "horizontal"> <rectangle fill = "{binding}" width = "30" Height = "30"/> <textblock text = "{binding}" margin = "12 0 0 0"/> </stackpanel> </datatemplate> </Toolkit: listpicker. itemtemplate> <Toolkit: listpicker. fullmodeitemtemplate> <! -- Fullmode item template --> <datatemplate> <stackpanel orientation = "horizontal"> <rectangle fill = "{binding}" width = "60" Height = "60"/> <textblock TEXT = "{binding}" margin = "12 0 0 0"/> </stackpanel> </datatemplate> </Toolkit: listpicker. fullmodeitemtemplate> </Toolkit: listpicker>
Fullmodeheader: Add a title to the full mode list
Itemssource: bind the content to be displayed in the list
You can bind the displayed content in either of the following ways:
A. itemssource = "{binding}" // bind it to XAML. In this case, you must pass the list to be bound to the system's datacontext = accentcolors;
B. listpicker2.itemssource = accentcolors; // dynamically bound list items