0
votes

Since 'A picture speaks a thousand words', see the picture below for what I'm trying to achieve with my custom Panel in WPF. (unfortunately, since I'm a relatively new user I cannot place an image as such - so characters it is!)

(each 'box' is represented by a number, overlapping area of boxes represented by '-', Time is on the horiztonal from left to right)

I don't want this:

    111111111-----2222222222----------2222222222222222222222222-----22222

I want this:

             222222222222222222222222222222222222222222222222222222222222
    11111111111111          3333333333                         44444

So you can see that I am wanting to displace objects in the vertical to prevent overlapping in the horizontal. So in my example, 'Box 2' has been displace up to prevent a partical overlap with 'Box 1' and entire overlap with boxes '3' and '4'. Just to be clear, I have no problem with the logic for the horizontal (left and width properties) of the objects.

I want to know: Is there is an algorithm that can automatically displace objects in the vertical to prevent this overlapping. (Obviously, I need a general solution that doesn't specifically apply only to my example above.)

Any help would be greatly appreciated.

Ciao, Pete

1

1 Answers

0
votes

Have you looked at the WrapPanel? It seems similar to what you want I think.