86 lines
2.1 KiB
C#
86 lines
2.1 KiB
C#
using System.ComponentModel;
|
|
using System.Drawing.Design;
|
|
using DevComponents.DotNetBar.SuperGrid.Primitives;
|
|
|
|
namespace DevComponents.DotNetBar.SuperGrid
|
|
{
|
|
/// <summary>
|
|
/// Represents the collection of grid items.
|
|
/// </summary>
|
|
[Editor("DevComponents.SuperGrid.Design.GridRowCollectionEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=26d81176cfa2b486", typeof(UITypeEditor))]
|
|
public class GridItemsCollection : CustomCollection<GridElement>
|
|
{
|
|
#region ClearItems
|
|
|
|
/// <summary>
|
|
/// ClearItems
|
|
/// </summary>
|
|
protected override void ClearItems()
|
|
{
|
|
int n = Items.Count;
|
|
|
|
for (int i = 0; i < n; i++)
|
|
{
|
|
GridContainer item = Items[i] as GridContainer;
|
|
|
|
if (item != null)
|
|
{
|
|
GridContainer parent = item.Parent as GridContainer;
|
|
|
|
if (parent != null)
|
|
parent.MergeScan = null;
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
if (FloatLastItem == true)
|
|
n--;
|
|
|
|
for (int i = 0; i < n; i++)
|
|
DetachItem(Items[i] as GridContainer, true);
|
|
|
|
base.ClearItems();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region RemoveItem
|
|
|
|
/// <summary>
|
|
/// RemoveItem
|
|
/// </summary>
|
|
/// <param name="index"></param>
|
|
protected override void RemoveItem(int index)
|
|
{
|
|
DetachItem(Items[index] as GridContainer, false);
|
|
|
|
base.RemoveItem(index);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region DetachItem
|
|
|
|
private void DetachItem(GridContainer item, bool clear)
|
|
{
|
|
if (item != null)
|
|
{
|
|
item.DetachNestedRows(false);
|
|
|
|
if (clear == false)
|
|
item.Parent = null;
|
|
|
|
GridPanel panel = item as GridPanel;
|
|
|
|
if (panel != null)
|
|
panel.DataBinder.Clear();
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|