Hi!Is there a best practice sample available which shows how to configure the TimeLineView to display a fixed 7 day time range?
I already figured out the intervals, headers.... but how do I get the correct column width? Actually I'am using a UIElementCreationFilter to get the OwnerHeaderWidth and ScrollBarWidth and calculating the Column Width. But these Column Width doesn't fit exactly into the Client Area - so there is a small gap left caused by the integer conversion. What's the best way to get rid of this gap? Is it possible to assign a width directly to a Column to expand the last Column?
(Please see attached picture!)
Best regards, Jens!
Hi Jens,
Thank you for posting in our forums.
Looking at the attached image, what I assume is making your calculations a little bit off is the border merging. Some of the borders (like the Solid ones in the TimeLineView) are merged. This means that the element to the right is drawn over the rightmost pixel of the left element. This is done in order to prevent double borders. So most likely in your case you will need to lower the width of the control with 2 pixels.
I have attached a sample demonstrating this approach. Let me know if this works for your scenario.
Please let me know if you have any additional questions.
Hi!
Thank you for your sample. But in your sample, you change the size of the TimeLineViewControl. My TimeLineView is located on a sizeable dialog and anchored to all sides. So my TimeLineViewControl is resized during window resize and I try to resize the columns in the TimeLineView to fit into the available space.
Snippet from my code:
ultraTimelineView1.ColumnWidth = (int)Math.Floor((ultraTimelineView1.ClientRectangle.Width - _rectOwnerHeader.Width - _rectScroll.Width) / 7.0);
My idea is expanding the last column to fill the gap or expanding the OwnerHeader. Maybe, you have a sample for me?
Best regards, Jens.
Thank you the clarification.
I found two ways to implement this. The first is a lot simpler, but is not that accurate – I found that using Math.Ceiling instead of Math.Floor and subtracting the values for the border merging (for which I spoke in my initial reply) everything works fine. The second approach is a bit more complicated, however it seems to fulfil your goal completely. I used the creation filter to stretch the last fully visible timeslots and headers. I calculate an offset based on how inaccurate the column width is and then use this offset to determine if I should stretch the UIElements.
I have attached a sample demonstrating these suggestions.
Works great - thank you!
Regards, Jens