Tuesday, July 7, 2015

How to iterate through TileView items in XtraGrid?

This is related to DevExpress question - How to loop through tiles in TileView, which help me to achieve the required functionality in the XtraGrid using the TileView. I require to implement the selection process for TileView similar to GridView in XtraGrid, but I require to iterate through all the TileView items. TileView actually use TileViewControl internally so it require to access under laying  tileview control items to access more information about the TileViewItems. See the below code snippet:

private void HandleTileItemSelection(TileViewItem tileViewItem)
{
if ((ModifierKeys & Keys.Control) != Keys.Control)
{
Dictionary visibleTiles = ((tileView1.GetViewInfo() as ITileControl).ViewInfo as TileViewInfoCore).VisibleItems;
int alternateCheckedItemsCount = 0;
foreach (KeyValuePair item in visibleTiles)
{
if (item.Value != tileViewItem && item.Value.Checked)
{
alternateCheckedItemsCount++;
item.Value.Checked = false;
tileView1.SetRowCellValue(item.Value.RowHandle, "CheckedStatus", false);
}
}
}
}

No comments :

Post a Comment