开发者

Flex 4 Custom Scroll bar on tree component

开发者 https://www.devze.com 2023-03-27 11:16 出处:网络
I want to customize the scrollbars on a mx|Tree component is Flex 4. I would 开发者_如何学JAVAlike to mimic this functionality: http://flexponential.com/2009/10/09/changing-the-position-of-the-scroll-

I want to customize the scrollbars on a mx|Tree component is Flex 4. I would 开发者_如何学JAVAlike to mimic this functionality: http://flexponential.com/2009/10/09/changing-the-position-of-the-scroll-bars-in-a-spark-list/

Any thoughts or reccomendations?


This can work, add your own error checking/styling, but you get the idea:

<s:VGroup gap="-1">
        <s:Button width="100%" label="Scroll up" click="{tree.verticalScrollPosition--}" />
        <mx:Tree id="tree" labelField="@label" showRoot="false" width="300" height="150"
                 verticalScrollPolicy="off">
            <mx:dataProvider>
                <fx:XML>
                    <root>
                        <node label="Parent 1">
                            <node label="Child 1" />
                            <node label="Child 2">
                                <node label="Grandchild 1" />
                                <node label="Grandchild 2" />
                            </node>
                            <node label="Child 3" />
                            <node label="Child 4" />
                            <node label="Child 5" />
                            <node label="Child 6" />
                            <node label="Child 7" />
                            <node label="Child 8" />
                            <node label="Child 9" />
                        </node>
                    </root>
                </fx:XML>
            </mx:dataProvider>
        </mx:Tree>
        <s:Button width="100%" label="Scroll Down" click="{tree.verticalScrollPosition++}"/>
    </s:VGroup>


you could also try to use verticalScrollBarStyleName/horizontalScrollBarStyleName with a css style. But ofc it lacks the comfort of spark skins. ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消