FIX. RadGridView - the TextAlignment property of GridViewHyperlinkColumn is not taken into consideration
Reproduce:
- add RadGridView
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;// Different alignment between the two columns
foreach (DataRow row in nwindDataSet.Customers.Rows)
{
this.radGridView1.Rows.Add(row.ItemArray[2], row.ItemArray[4], row.ItemArray[4]);
}
}
Workaround:
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
GridHyperlinkCellElement cell = e.CellElement as GridHyperlinkCellElement;
if (cell != null)
{
cell.ContentElement.TextAlignment = ContentAlignment.MiddleRight;
}
}