We have created custom sort indicators to go below the text in a column so we can utilise the space as much as possible.
The existing sort indicators require additional column width to fit the image in. While using our custom image some column text is being trimmed even though we are using our own indicators.
How I can I stop the control from trimming my column text to make space for the sort indicators (which no longer exist)? Do I need to add further functionality to my draw filter?
Problem solved. The default sort indicator is 9 pixels. I simply need to extend the width of the TextUIElement by 9 pixels and problem solved.
The 16 pixels was misleading because this was 9 pixels for the default sort indicator, and a further 7 pixels covering the filter button. The filter button was actually still being prevented from being clicked on half the image.
I think I might have figured it out... The issue is with my CreationFilter and the change discussed above about the text being trimmed. Changing the TextUIElement rectangle to match the RectInsideBorders.Width was preventing the click. Changing this bit of code within the AfterCreateChildElements method to simply extend the width by two-thirds of the width of my custom sort indicator seems to do the job.
However, I'm not sure why 16 pixels seems to do the job when my custom sort indicator is 24 pixels in width... Oh well!
I have a further follow up question on this subject...
While using my custom sort indicators I am getting an issue with the filter buttons not being clickable. The custom sort indicator is drawn, the image for the filter button is drawn, but no boundary appears that indicates it can be clicked, and therefore, it cannot be clicked. How can I get my draw filter (or creation filter) to draw the filter button as normal?
P.S. I am overriding the HeaderUIElement for Win.DrawPhase.AfterDrawElement to draw my sort indicator.
That will do nicely... Thank you Brian & Mike.
Hi,
The code to calculate the positions of the elements can be quite complex. It has to account for a wide range of buttons, like Filtering, sorting, swapping, checkboxes, etc. But you presumably know which of these features are enabled in your grid, so you can probably just use headerUIElement.RectInsideBorders as your working rect.