I am creating a timeline control that uses listbox to place my items on a canvas.
There are two parts to it. The base timeline to represent an 8 hour work day and the individual timeline elements which represent the type of work with start and end times.
The timeline element can be resized using a thumb control docked to the left and right of each element. The resizing works fine if I place the timline element on a canvas directly, but as I need to maintain a list of elements I thought that a listbox would handle it for me. So I made the ItemsPanel a canvas and sure enough everything rendered nicely. The only problem was that I could no longer resize the timeline elements. Quickly I relized, that setting the canvas.Left on my element when dragging would do nothing because the element was no longer on the canvas but inside a listboxitem (which is on the canvas).
Is it possible to have a Listbox stop wrapping each item in its own listboxitem and wrap them in say a custom ContentControl instead?
Try this:
Reference: How to change the default item container for ItemsControl?