Welcome!

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

Reply
Highlighted
Developer
Posts: 181
Registered: ‎07-19-2012
My Device: Q5, Q10, Z10, Z30, PlayBook
My Carrier: Carrier

How to make ListItemComponent which does not include StandardListItem selectable?

I have a ListView which inside ListItemComponent includes custom controls placed inside Container control rather than using StandardListItem control. 

 

The problem I have is that rows in my ListView are not selectable. What is the easiest way to make such a list row selectable so it behaves just like regular StandardListItem?

 

Here is my code:

 

ListView {
    layout: FlowListLayout {
    }
    dataModel: XmlDataModel { source: "contacts.xml" }
    
    listItemComponents: [
         ListItemComponent {
             type: "contact"
             
             Container {
                 Container {
                    layout: StackLayout {
                        layoutDirection: LayoutDirection.LeftToRight
                    }
                    Label {
                        id: contactID
                        text: ListItemData.contactID
                        layoutProperties: StackLayoutProperties {
                            spaceQuota: 1.5
                        }
                    }
                    Label {
                        id: contactName
                        text: ListItemData.contactName
                        layoutProperties: StackLayoutProperties {
                            spaceQuota: 2.0
                            horizontalAlignment: HorizontalAlignment.Left
                            verticalAlignment: VerticalAlignment.Top
                        }
                    }
                }
            Container {
                Divider {
                }
            }
         }
                 
     }
 
                  
 
     ]
}

 

---
If you find my post helpful please "like" it and "accept as a solution"
Contributor
Posts: 20
Registered: ‎08-02-2012
My Device: -
My Carrier: SW Developer

Re: How to make ListItemComponent which does not include StandardListItem selectable?

Retired
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: How to make ListItemComponent which does not include StandardListItem selectable?

Hi there,

 

Have you taken a look at the WeatherGuesser sample app?

https://developer.blackberry.com/cascades/sampleapps/

 

Martin