Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
Truncate or TextTrimming from the left
posted

I am trying to set the ellipses on the left side of the cell and have the content fill up the cell from the right side. Is it possible to use TextTrimming to trim from the start of the string?

  • 469350
    Offline posted

    Hi Jason,

    The Ellipsis that you typically see in a grid cell is essentially handled by the DrawString method on the Graphics object. So it's not something specific to the Infragistics code, it's a function of the DotNet Framework. You might want to check Microsoft's documentation to see if I might be wrong, but as far as I know, Graphics.DrawString never shows the ellipsis on the left.

    Having said that, the screen shot you have here looks like it's showing more of an overflow button, rather than an ellipsis. It's a subtle distinction, but showing an overflow button is different than simply appending (or prepending) "..." to the text.

    The reason I mention that is that the UltraTextEditor control has OverflowIndicator functionality. It doesn't have a built-in way to show the button on the left, but this could be achieved with some extensibility code using a CreationFilter to move the button to the left, and a DrawFilter to draw the text such that you see the end instead of the beginning.

    Anyway, if I haven't scared you off by now and you are still with me by this point on this roller-coaster ride - I whipped up a sample project that demonstrates the approach of using an UltraTextEditor with a DrawFilter and a CreationFilter to achieve what I think you want here.

    The sample works pretty well, I think, but there are a few things you will probably want to adjust.

    The DrawFilter and/or CreationFilter code might need to be updated to determine which columns they should operate on.

    Also, the Overflow indicator shows a couple of arrows by default. So you might want to set the OverflowIndicatorImage (on the UltraTextEditor) to something more appropriate, like arrows pointing the other way, or an image of an ellipsis.

    Please feel free to let me know if you have any questions.

    WinGrid_Overflow indicator on the left_CS.zip