Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 84
Registered: ‎04-22-2013
My Device: BB 10 Dev
My Carrier: Simulator

How to make List Item onSelectionChanged remains highlighted

Hi all,

Can I know how to make the selected index container remains highlighted, currently it highlights the list item only when the user is holding it and goes off after the user leaves his hand.

I want to highlight the first index container by default, and when user touches on the 3rd item container, then the first box will changed to default (no highlight) and 3rd item container will be highlighted.

Any ideas on how should i do it.

Thanks in advance.


                            listItemComponents: [
                                ListItemComponent {
                                    type: "example"
                                    ExBox {
                                        id: ex
                                        preferredWidth: 768

                                        title: ListItemData.title
                                        desc: ListItemData.desc
                                        cont: 0.5

                                        function setHighlight(highlighted) {
                                            if (highlighted) {
                                                acc.cont = 1.0;
                                            } else {
                                                acc.cont = 0.5;
                                        // Connect the onActivedChanged signal to the highlight function
                                        ListItem.onActivationChanged: {

                                        // Connect the onSelectedChanged signal to the highlight function
                                        ListItem.onSelectionChanged: {


Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: How to make List Item onSelectionChanged remains highlighted

You can use ListView's select() and toggleSelection() functions...



If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: How to make List Item onSelectionChanged remains highlighted

Hi jessica99327, you can use the 10.2 new API CustomListItem. In this API, the highlight behavior of the item is automatically handled by the API.


Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker