我有这样的数据设置..
事务
*-名称
数据-ID
数十亿美元
**- Tags <--标签数组
*名称
在网站中,我可以遍历标签并创建每个带有链接的标签的跨度,我正在试图弄清楚如何在XtraGrid (DevExpress)中将这种结构添加到windows表单应用程序中。
希望是这样的..
*ID*标签
*
我不确定如何实现这一点。
发布于 2012-02-22 12:48:36
您可以使用GridView.CustomDrawCell Event设置显示文本的格式,但不应使用网格视图编辑器编辑这些标记。可以更改单元格的显示文本( RowCellCustomDrawEventArgs.DisplayText参数。
private void advBandedGridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
//GridView currentView = sender as GridView;
//if(e.RowHandle == currentView.FocusedRowHandle) return;
if (e.Column.FieldName != "Tags") return;
string[] arr = (string[])e.CellValue;
string csv = String.join(',', arr);
e.DisplayText = csv;
// set e.Handles to true if you want custom drawing..
e.Handled = true;
}检查在GridView.CustomDrawCell事件文档页面上指定的自定义绘图部分链接。
另一种方法是将逗号分隔的标签存储在与网格控件绑定的表中。然后你就可以毫无问题地编辑它们了。你有一些自定义的处理更新,插入事件,这将比显示自定义文本要好得多。
选择更适合您的方法。希望这能有所帮助。
https://stackoverflow.com/questions/9302746
复制相似问题