Exemplo n.º 1
0
 /// <summary>
 /// Event handler for the OnCollapse event.
 /// </summary>
 /// <param name="e">Event arguments</param>
 /// <returns>true to bubble, false to cancel</returns>
 protected virtual bool OnCollapse(EventArgs e)
 {
     if (Expanded)
     {
         Expanded = false;
         // If this node was selected, unselect it and make the parent the selected node
         // Note: The client handles this nicely uplevel; we only need to do this downlevel
         if (!ParentTreeView.IsUpLevel)
         {
             String strNewIndex = GetNodeIndex();
             String strOldIndex = ParentTreeView.SelectedNodeIndex;
             if (strOldIndex.StartsWith(strNewIndex) && strOldIndex != strNewIndex)
             {
                 TreeViewSelectEventArgs e2 = new TreeViewSelectEventArgs(strOldIndex, strNewIndex);
                 ParentTreeView.DoSelectedIndexChange(e2);
                 // Since this only gets called downlevel, we don't need to worry about other selection
                 // changes being queued-- this will be the only one, and so we can queue an event for it
                 ParentTreeView._eventList.Add("s");
                 ParentTreeView._eventList.Add(e2);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }