Creating a Dynamic Calendar in Silverlight
I am trying to create a long range calendar that dynamically loads (and dumps) event data as the user scrolls left or right in time. I'm really trying to figure out how to lay down the basic structure of the UI and how to dynamically build the interface as the user scrolls by clicking and dragging in the viewport. See the image below for a basic intent diagram. Each slice has potentially multiple rectangles in it for events that happened on that day (slice). I would like each piece to be a canvas so that I can position these rectangles correctly. alt text http://www.mistertnt.com/images/DynamicCalendarDiagram.jpg
There are a few problems that I don't know how to deal with yet, but this is the first big one I've been pondering for a while and can't wrap my head around completely:
- I know how to dynamically create controls, but how can I add things to one end of the scrolling content while removing things from the other depending on how the user scrolls?
Any guidance in the right direction would be much appreciated! Thanks.
a source to share
If you assign a name to your panel (you might be using a StackPanel, I guess) you can react to events in the ScrollViewer to add or remove items. If your linked data is an ObservableCollection it will probably be even easier.
However, you will almost be virtualizing data and this is a tricky business.
Use Silverlight 3 VirtualizingStackPanel to help with this process.
a source to share