Monday, March 1, 2010

Flex Expand Collapse Panel - Custom Component

It has been an extremely long time since my last post. To explain the delay, I would need to write about half a dozen posts. That comes later. This post is just to record a very simple and basic custom component I did a few days back.

It is a simple component extending the Panel and just adds a small Maximize/Minimize toggle button on the top right corner that resizes the panel based on the dimensions specified in the markup.

I blame the requirement for the simplicity of this component. It is just what they wanted. Nothing fancy about it.

It was quite simple to do. The only challenge was to deal with Flex as it does not know what to do when the component has its own set of child components declared internally and also when we try to add a few more, at the declaration…

The solution was pretty straightforward. The source code is available here and I tried to host an example here. When viewing the demo, just click on Open if your browser prompts you about handling the file.