我有一个UltraGrid
,它绑定到带有两列(键值)的DataTable
。我在DataTable中添加了10行,现在第11行在Value列中有一个URL。 URL值可以很好地添加,但它不能像超链接一样工作。要使其作为超链接工作,我如何需要将此行添加到UltraGrid中? 我的代码:Infragistics UltraGrid中的超链接单元格
DataTable dt = new DataTable();
dt.Columns.Add("Key", typeof(string));
dt.Columns.Add("Value", typeof(string));
ultraGrid.DataSource = dt;
foreach (KeyValuePair<string, string> kvp in dictionary)
{
dt.Rows.Add(kvp.Key, kvp.Value);
}
// Adding the row which has the URL value.
string url = "SomeURL";
Uri hyperLink = new Uri(url);
dt.Rows.Add("Click this", hyperLink);
这将更改列中的每个单元格而不仅仅是最后一个。 – Steve
您可以在单元上设置样式:http://help.infragistics.com/NetAdvantage/WinForms/Current/CLR4.0/?page=Infragistics4.Win.UltraWinGrid.v12.2~Infragistics.Win.UltraWinGrid.UltraGridCell_members .html – alhalama
链接被@alhalama打破了评论。基本上你可以做'cell.Style = ColumnStyle.URL'。这里是[当前文档]的链接(http://help.infragistics.com/Help/Doc/WinForms/2014.2/CLR4.0/html/Infragistics4.Win.UltraWinGrid.v14.2~Infragistics.Win.UltraWinGrid。 UltraGridCell_members.html),希望它不会太早破坏。 (Infragistics需要修复他们的文档,yeeesh!) –