You can use this type of additional property to quickly record the selection information of ListBox/listview on the interface.
This type is called listcounter and has three additional attributes:
ListBox: Specifies the target ListBox or listview.
Property: string type, which specifies the attributes of the current object to be set.
Formatstring: string type. Optional (because of the default value). The format string is specified. {0} indicates the number of all elements, and {1} indicates the number of selected elements.
It is easy to use, for example:
<ListBox name = "lbx" selectionmode = "extended"/>
<Textblock LOC: listcounter. ListBox = "{binding elementname = lbx }"
Loc: listcounter. Property = "text"/>
Result:
The text attribute of textblock is set to the selection information of ListBox.
Of course, you can add custom format strings or set other attributes:
<ListBox name = "lbx" selectionmode = "extended"/>
<! -- Set the content of the button -->
<Button name = "TBL"
Loc: listcounter. formatstring = "{}{ 1}/{0 }"
Loc: listcounter. ListBox = "{binding elementname = lbx }"
Loc: listcounter. Property = "content"/>
Preview:
Source code download
Note: This is an archive of Microsoft SkyDrive. Please download it directly in your browser. Some download tools may not be available for download.
File Type:. CS File