This is a migrated thread and some comments may be shown as answers.

Old GridViewHyperLinkColumn TextAlignment bug resurfaces

2 Answers 58 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 06 Aug 2013, 02:56 PM
I'm currently evaluating Telerik Winforms controls for a project (specifically, the GridView).  I downloaded the installer yesterday so I believe I'm using the most recent version (RadControlsForWinFormsSetup_2013_2_724).  Everything is working fine except the TextAlignment on GridViewHyperlinkColumns.  I found an old forum post about this issue:

http://www.telerik.com/community/forums/winforms/gridview/gridviewhyperlinkcolumn-ignoring-textalignment-bug.aspx

I tried the workaround posted but it didn't work.  After some research, I found this page:

http://www.telerik.com/releasehistory.aspx?id=523

Which states the bug was fixed back in the "RadControls for WinForms 2012.3 1017 Oct 17, 2012" release.  However, I'm seeing the bug as described in the old forum post.  Here's a sample of the data bound to a text box and then bound to a hyper-link column, both with TextAlignment set to MiddleLeft:

http://imageshack.us/photo/my-images/818/yk3m.png/

Is this a regression issue?  Is there a work-around for this?  The workaround posted in the original thread no longer works.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Aug 2013, 01:55 PM
Hello Patrick,

Thank you for contacting Telerik Support.

I confirm that the issue was not fully resolved. TextAlignment property affects only the ContentElement.Alignment property of the GridHyperlinkCellElement while it should also set the ContentElement.TextAlignment property. I have reopened the PITS-issue which and we will address it accordingly. I have also updated the Telerik points to your account for the cooperation. Until then, the appropriate workaround is:
private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.
            this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
 
            DataColumn colContactName = nwindDataSet.Customers.Columns["ContactName"];
            DataColumn colAddress = nwindDataSet.Customers.Columns["Address"];
 
            this.radGridView1.Columns.Add(colContactName.ColumnName);
            this.radGridView1.Columns.Add(colAddress.ColumnName);
            this.radGridView1.Columns.Add(new GridViewHyperlinkColumn(colAddress.ColumnName + " Link"));
 
            this.radGridView1.Columns["Address"].TextAlignment = ContentAlignment.MiddleRight;
            this.radGridView1.Columns["Address Link"].TextAlignment = ContentAlignment.MiddleRight;
 
            foreach (DataRow row in nwindDataSet.Customers.Rows)
            {
                this.radGridView1.Rows.Add(row.ItemArray[2], row.ItemArray[4], row.ItemArray[4]);
            }
        }
 
        private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
        {
            GridHyperlinkCellElement cell = e.CellElement as GridHyperlinkCellElement;
            if (cell != null)
            {
                cell.ContentElement.TextAlignment = ContentAlignment.MiddleRight;
            }
        }

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Patrick
Top achievements
Rank 1
answered on 09 Aug 2013, 02:09 PM
Thanks for the workaround Desislava!


Tags
GridView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or