More Atlas Extenders in dasBlog
Guess what, kiddies! More Atlas goodness incorporated into dasBlog. This time in the form of the rounded corners you see in the nav bar on the right, courtesy of the RoundedCornersExtender. And just because I can, try clicking and dragging the title of any of the sections in the nav bar (but don't click too high into the rounded corner section). That, my friends, is the DragPanel in action.
OK, maybe dragging nav sections isn't the most practical thing in the world but you gotta admit it's cool.
Turns out it's not too hard to create Atlas Control Toolkit extenders programmatically. You treat it like any other web control. You create it and add it to another objects Controls collection.
But you can't do it in the Render method. If you do, nothing really happens. Nothing is output in the <pageManager>. But add it in the CreateChildControls method and it works fine.
And extenders require a target control. An ASP.NET target control, not an HTML control. So for the SideBarList, SideBarOpmlList and CategoryList, I had to create a Panel and add the main section control to it rather than the base control's Controls collection.
To summarize what I did for each of these controls:
- Override CreateChildControls
- Move all code from the Render method to CreateChildControls except the last line: section.RenderControl( output );
- Delete the Render method
- Add a Panel at the beginning of CreateChildControls and change this.Controls.Add( section ) to panel.Controls.Add( section )
- Add a RoundedCornersExtender and a DragPanelExtender and set the Panel as the target control
That's the high-level view. I had to do some tweaking to the height of the nav bar because it seems the DragPanelExtender makes the target control absolutely positioned, probably by necessity. I also had to add a container class for the WeblogCalendar so that I could add the extenders around it.
The bad news: Configuration for the extenders is severely hard-coded. No changing parameters on the fly here. And at the moment, that suits me fine. If there is enough interest from people to do this themselves, maybe I'll work on it some more.