コード例 #1
0
    private static void ClearCellVisualState( Cell cell )
    {
      if( cell == null )
        return;

      ContextMenu contextMenu = cell.ContextMenu;

      // Ensure to close the ContextMenu if it is open and the Cell
      // is virtualized to avoid problems with ContextMenus
      // defined as static resources that won't be able to reopen
      // again if the Close private method is called after the 
      // PlacementTarget is removed from the VisualTree
      if( ( contextMenu != null ) && ( contextMenu.IsOpen ) )
      {
        contextMenu.IsOpen = false;
      }

      cell.ClearContainerVisualState();
    }