Hi,
I'm working on a timeline view with the owner header set to horizontal. We want to display the owner name on multiple lines and so far the only way I have found to do this is with a draw filter on the BeforeDrawElement draw phase of the TextUIElement that shows the owner name.
Having split the name text, set the element to multiline and increased its height I now have the text displaying as required, however I cannot find a way to resize the Owner Header width so that we may reclaim some of the UI surface that was being taken by the very wide single line header.
Any thoughts on how this can be achieved?
Regards, Jim.
Hello Jim,
If you could provide us your DrawFilter, I will be glad to take a look at it. Another thing that might help is setting the header text like = "some text " + Environment.NewLine + " other text "; If that's not help you could try with a creation filter where you would be able to assing a new Recangle on the desired TextUIElement once you modified like :
YourTextUIElement.Rect = new Rectangle(desiredX,desiredY,height,width);
where your desiredX and desiredY might be the coordinates of the YourTextUIElement.Rect.X and Y.
In the CreationFilter you would probably have to use AfterCreateChildElements method to change the Rect, and just Return false in the BeforeCreateChildElements method.
If you have any questions or if you need any assistance please do not hesitate to ask.
Hi Danko,
Thanks for your response.
I am using Environment.NewLine exactly as you suggest and as a result the text is displaying just how I require it.
I had hoped that as the width of the header appears to be calculated based on the text within that this would be enough to cause the header to resize and perhaps it might, if only I knew the correct point in the creation/draw process to intervene. I don't!
I've attached a sample with my DrawFilter as you suggested. If you can offer any further advice off the back of this I would be grateful.
Yep, that sorts it!
Thanks Brian.
Your problem is caused by the fact that our internal measurement logic doesn't know about your IUIElementDrawFilter implementation, and makes the width of the header that which is necessary to accommodate the owner's name at the given orientation.
You can hack this out by assigning the first line of the text you want to display to the owner's name propert. This will essentially trick the measurement logic into thinking that is all the space it needs to display the owner's name.