Source/NFX.WinForms/Elements/ElementHostControl.cs
/// <summary>
/// Deletes all elements efficiently. Calls Dispose() for each element 
/// </summary>
Deletes all elements efficiently. Calls Dispose() for each element
Deletes all elements efficiently . Calls Dispose () for each element
public void DeleteAllElements(Func<Element, bool> keepFilter = null)
      {
        releaseMouseDragElement(null);
        releaseMouseEnteredElement();
        m_LastMouseDownElement = null;
        ElementList kept = null;
        foreach(var elm in m_ElementList)
        {
          if (keepFilter!=null && keepFilter(elm))
          {
            if (kept==null) kept = new ElementList();
            kept.Add(elm);
            continue;
          } 
          elm.m_Host = null;
          elm.Dispose();
        }  
        m_ElementList.Clear();
        if (kept!=null)
         m_ElementList = kept;
        Invalidate();
      }
public void DeleteAllElements ( Func < Element , bool > keepFilter = null ) { releaseMouseDragElement ( null ) ; releaseMouseEnteredElement ( ) ; m_LastMouseDownElement = null ; ElementList kept = null ; foreach ( var elm in m_ElementList ) { if ( keepFilter != null && keepFilter ( elm ) ) { if ( kept == null ) kept = new ElementList ( ) ; kept . Add ( elm ) ; continue ; } elm . m_Host = null ; elm . Dispose ( ) ; } m_ElementList . Clear ( ) ; if ( kept != null ) m_ElementList = kept ; Invalidate ( ) ; }
Deletes all elements efficiently.
Deletes all elements efficiently .
//prevent elements from unregistering with host because it is slower than host.list.Clear()
keepFilter
Func<Element, bool>