Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to add additional data to the list box?

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: sathya_an (26 Mar 2008)
Last edited: hamishwillee (30 May 2013)

The list boxes have predefined formats to display data and the datainput is given according to those formats and are displayed. Suppose if we want to add more columns and store user data in the list but they need not be displayed.

We can achieve this by creating an array list and store the all the data entries in the array list. When the array list is passed to the listbox model it reads the data corresponding to its own format and rest of the data would not be displayed (remain invisible). But still the invisible data can be retrieved by accessing the array list since it is stored there.


The CAknSingleGraphicStyleListBox list box has the following format:



- %d's correspond to the index of icon used in the A, C and D columns
- %S corresponds to a string that will be displayed in the B column

We create an array list with these four columns and pass it to the listbox model.

If the input data for row1 is ICON1, USERDATA1, ICON2, ICON3 respectively, then the data displayed in the CAknSingleGraphicStyleListBox would be


For the same array list two more columns can be added, for example USERDATA2 and USERDATA3


The input data for the list box would now be ICON1, USERDATA1, ICON2, ICON3, USERDATA2,USERDATA3 and the output displayed in the CAknSingleGraphicStyleListBox would still be


But the values of the invisible data USERDATA2 and USERDATA3 can be retrieved since they are being stored in the item array list.

Related Links:

Example application

File:ListBox ModelEx

This page was last modified on 30 May 2013, at 04:33.
23 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.