1.
DevExpress.XtraGrid.Views.Tile.TileView 使用DataTable作为数据源时,默认选择第一行使用 tile_Reason.Columns.View.FocusedRowHandle = 0;
2.绑定数据源后,能单击能查到数据,但页面不显示,需要绑定控件的_ItemCustomize 方法
private void tile_Reason_ItemCustomize(object sender, TileViewItemCustomizeEventArgs e)
{
if (e.Item == null) return;
DataRowView dv = tile_Reason.GetRow(e.Item.RowHandle) as DataRowView;
if (dv != null)
{
e.Item.Elements.Clear();
string desc = AccsGlobal.LanguageString(dv["PointRuleB"].ToStringAndTrim(), dv["PointRuleB"].ToStringAndTrim(), dv["PointRuleB"].ToStringAndTrim());
e.Item.Elements.Add(GetItemElement(desc, new Point(5, 5)));
}
}
private TileViewItemElement GetItemElement(string desc, Point point)
{
TileViewItemElement element = new TileViewItemElement();
element.Appearance.Normal.Font = new System.Drawing.Font("微软雅黑", 10F);
element.Appearance.Normal.ForeColor = Color.Black;
element.Appearance.Normal.Options.UseForeColor = true;
element.Appearance.Normal.Options.UseFont = true;
element.Text = desc;
element.TextAlignment = DevExpress.XtraEditors.TileItemContentAlignment.TopLeft;
element.TextLocation = point;
return element;
}
标签:Normal,Appearance,element,Item,使用,dv,DevExpress.18,desc From: https://www.cnblogs.com/jtcr/p/17767297.html