0

有没有办法通过 Accordion headerRenderer 发现选择了哪个孩子?

我正在使用来自 flexlib 的 CanvasButtonAccordionHeader,我只想在 selectedChild 的标题中显示一个组件。

感谢您提供任何有用的提示。

4

1 回答 1

1

您可以使用定义内联headerRenderer并使用该outerDocument属性。这是一个例子:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:ns="http://code.google.com/p/flexlib/">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <mx:Accordion id="acc" width="400" height="400" headerHeight="40">
        <mx:headerRenderer>
            <fx:Component>
                <ns:CanvasButtonAccordionHeader label="{'selected ' +outerDocument.acc.selectedChild.label}">   
                </ns:CanvasButtonAccordionHeader>
            </fx:Component>
        </mx:headerRenderer>
        <mx:Canvas   label="Personal"  toolTip="Child number one">
            <mx:Label text="Contents of Child 1" />
        </mx:Canvas>
        <mx:Canvas label="Accounts" toolTip="Child number two">
            <mx:Label text="Contents of Child 2" />
        </mx:Canvas>
        <mx:Canvas label="Help" toolTip="Child number three">
            <mx:Label text="Contents of Child 3" />
        </mx:Canvas>
    </mx:Accordion>
</s:Application>

戴维德

于 2013-02-13T13:43:48.947 回答