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
Developer
Posts: 91
Registered: ‎09-25-2012
My Device: bb10 alpha
My Carrier: free

Custom controller using native theme ?

Hello,

 

I wanted to create my custom TitleBar working with a DropDown like in the calendar. So, I have to remake all from the scratch. 

I m going to start with a container . So, My question is  : How can I set the background of the container to make it looking like the cascade TitleBar ? 

 

 

... QtComponent... I miss you

a lover of Qt
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Custom controller using native theme ?

It happens that I made a Settings page for one of my apps yesterday, and did something similar for the title area. No DropDown though, but same gradient background. It could be a starting point for something more.

 

Page {
    Container {
        // top container for title/header
        Container {
            horizontalAlignment: HorizontalAlignment.Fill
            minHeight: 100
            maxHeight: minHeight

            layout: DockLayout {}

            ImageView {
                imageSource: "title_bg_gradient.png"
                horizontalAlignment: HorizontalAlignment.Fill
            }

            Container {
                verticalAlignment: VerticalAlignment.Center
                leftPadding: 25
                Label {
                    text: qsTr("Settings")
                    textStyle.base: SystemDefaults.TextStyles.TitleText
                }
            }
        }
   ...

 

The image in my case is 100px tall by 10px wide but could just as well have been 1px wide, with a vertical gradient. It's scaled automatically to fill the whole width. It looks like this:

Page header


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!