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
1815
Ultrawingrid CardView Caption Text wrapping
posted


I am using Visual Studio 2015, Vb. Net and 17.1 of the controls

I have a Ultrawingrid that I would like to display in CardView

I set the Caption Text to be the content of one column and hide that column in Cardview

The text in the column that I am using for the Caption is word wrapping but despite having set Caption lines to 3  the text in the card caption wont wrap

Is there a way to force word wrap for the text of a ultrawingrid Card caption?

Thank you in advance for your help

  • 960
    Offline posted

    Hello skalyniuk,

    I'm investigating your issue about how to wrap texts in card view caption. I'll let you know when there are any updates on the investigation, so please wait for a while until then.

    Thank you for your patience.


    Best Regards,
    Noriko I.
    Developer Support Engineer

  • 960
    Verified Answer
    Offline posted

    Hello skalyniuk,


    I've investigated the issue and found that there are no built-in properties or methods to specify text-wrapping on card view caption area.

    Instead, you could use DrawFilter:
        Draw Filter
        https://www.infragistics.com/help/winforms/win-draw-filter

    In GetPhasesToFilter method, you could check whether the UI element is CardCaptionUIElement and if it is the case, you could return DrawPhase.BeforeDrawForeground.
    And in DrawElement method, set WrapText as True when the CardCaptionUIElement has a child which is TextUIElement.

    Here is a code snippet:


        UltraGrid1.DrawFilter = New MyDrawFilter()

        ....

        Imports Infragistics.Win
        Imports Infragistics.Win.UltraWinGrid

        Public Class MyDrawFilter
            Implements IUIElementDrawFilter

            Private Function IUIElementDrawFilter_DrawElement(drawPhase As DrawPhase, ByRef drawParams As UIElementDrawParams) As Boolean Implements IUIElementDrawFilter.DrawElement
                Dim cardCaptionUIElement = TryCast(drawParams.Element, CardCaptionUIElement)
                If cardCaptionUIElement IsNot Nothing AndAlso cardCaptionUIElement.ChildElements.Count > 0 Then
                    Dim textElement = TryCast(cardCaptionUIElement.ChildElements(0), TextUIElement)
                    If textElement IsNot Nothing Then
                        textElement.WrapText = True
                    End If
                End If

                Return False
            End Function

            Private Function IUIElementDrawFilter_GetPhasesToFilter(ByRef drawParams As UIElementDrawParams) As DrawPhase Implements IUIElementDrawFilter.GetPhasesToFilter
                If TypeOf drawParams.Element Is CardCaptionUIElement Then
                    Return DrawPhase.BeforeDrawForeground
                End If

                Return DrawPhase.None
            End Function
        End Class

    I hope this will help you.


    Best Regards,

    Noriko I.
    Developer Support Engineer
    Infragistics, Inc.