Ticket T495313
Visible to All Users

Horizontal TextAlignment does not work for tileview in xtragrid

created 8 years ago

I have taken a grid with tileview on a windows page and am composing the template and the elements for the tile view from the code behind.

The code i am using is as follows -

addressValue.Column = tileView1.Columns("NewItemName")
            addressValue.AnchorElement = splitLine
            addressValue.AnchorIndent = 2
            addressValue.AnchorOffset = New Point(SubWidth / 10, 0)
            addressValue.AnchorAlignment = DevExpress.Utils.AnchorAlignment.Bottom
            'addressValue.TextLocation = New Point(0, 100)
            addressValue.MaxWidth = SubWidth - ((SubWidth / 9))
            addressValue.TextAlignment = TileItemContentAlignment.TopCenter
            addressValue.Appearance.Normal.FontSizeDelta = 3
            addressValue.Appearance.Normal.FontStyleDelta = FontStyle.Regular
            addressValue.Appearance.Normal.ForeColor = Color.FromA#333333 '' Color.Black
            'addressValue.Appearance.Normal.Font = New Font("Humanst521 BT", 7.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (CByte(0)))
            addressValue.Appearance.Normal.Font = New Font("Humanst521 BT", 12, FontStyle.Regular, GraphicsUnit.Pixel)
            addressValue.Height = (Subhight * 30) / 100
            'addressValue.Appearance.Norm

The problem is that the Value is not getting aligned even though i  have used the instruction of TextAlignment. The alignment does not change for any of the alignments that i select - left, right or Center.

Please help asp.

Comments (2)
DevExpress Support Team 8 years ago

    Hello Vinod,

    Would you please clarify if other customizations work as expected? Currently, I assume that the issue occurs because your instance of the TileViewItemElement class is not added to the TileView.TileTemplate collection. I have created a small sample project based on your code and it works well on my side. If my suggestion about the TileTemplate collection does not help, please modify my sample or create your own one to illustrate the issue. I hope to hear from you soon.

      Dear Aleks,

      Thanks for the prompt response.

      I have recreated my problem in your sample and the same is attached herewith.

      To give you more details, I have taken a template with 4 elements namely an Image, splitline horizontal, splitline vertical and text. And these have to in the order of image, splitlines and text as the last element. If i follow your code then i cannot get the anchoring of these elements in the order in which i need them.

      Please help

      Answers approved by DevExpress Support

      created 8 years ago

      Hello Vinod,

      Thank you for the sample project. It helped me to understand your scenario. As stated in the AnchorElement property's description, this option is used when the TextAlignment and TextLocation properties do not allow you to place an element at the desired position. That is why, when you provide the AnchorElement property with another element, TextAlignment and TextLocation are not in effect. To accomplish your task, I suggest you calculate TextLocation or AnchorOffset manually (as you did it before). As an alternative, you can place a text to the bottom of a tile. Let me know if anything remains unclear. I will elaborate on these points.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.