public ColumnManager(IController parent, IColumnManagerOwner owner) : base(parent) { Owner = owner; if (Owner != null) { Scrollbar = Owner.HScrollBar; } Columns = new DataGridColumnCollection(); m_Observable = new Observable <EventMessage> (); }
public void SetWidth(float width, float boundsWidth, DataGridColumnCollection columns) { if (m_Width > 0 && m_Width <= 1) { //m_Width = Math.Min(0.9f, (float)width / (float)boundsWidth); float totalWidth = 0f; foreach (var col in columns) { totalWidth += col.AbsoluteWidth(boundsWidth); } float ratio = totalWidth / (float)boundsWidth; float total2 = 0; if (Math.Abs(ratio - 1f) > float.Epsilon) { foreach (var col in columns) { if (col != this) { col.Width /= ratio; float absw = col.AbsoluteWidth(boundsWidth); if (absw < col.MinWidth) { col.Width *= col.MinWidth / absw; } } total2 += col.AbsoluteWidth(boundsWidth); } } if (total2 > boundsWidth) { m_Width *= boundsWidth / total2; } } else { m_Width = width; } }
protected override void CleanupManagedResources() { ColumnCollection = null; base.CleanupManagedResources(); }