private void Expand(ColumnDefinition col)
        {
            // Filter out expand events at load and when is created or destroyed ExplorerCodeViewGrid
            if (!_loaded || col.MaxWidth == 0 || (double.IsPositiveInfinity(col.MaxWidth) && _explorerCodeViewGrid == null))
            {
                return;
            }
            col.MinWidth = _columnWidthMap[col].Minimum;
            col.MaxWidth = double.PositiveInfinity;

            // If not last column, substract new width from the next column if expanded
            // If last column substract from previous column if expanded
            // Afterwards let WPF handle it
            int index = _columnWidthMap.IndexOf(_columnWidthMap[col]);
            DefinitionStorage definition = (index < _columnWidthMap.Count - 1) ? _columnWidthMap[index + 1] : _columnWidthMap[index - 1];
            ColumnDefinition  colDef     = (ColumnDefinition)definition.Definition;

            double width = _columnWidthMap[col].Actual;

            // Check if expanded
            if (colDef.MaxWidth != DimensionCollapsedExpander)
            {
                double newWidth = Math.Max(colDef.Width.Value - (width - DimensionCollapsedExpander), definition.Minimum);
                colDef.Width = new GridLength(newWidth, GridUnitType.Star);
            }

            col.Width = new GridLength(width, GridUnitType.Star);
            CheckExploreCodeViewGrid();
        }
        private void Collapse(ColumnDefinition col)
        {
            if (col.MaxWidth != 0)
            {
                _columnWidthMap[col].Actual = col.Width.Value;
            }

            col.MinWidth = DimensionCollapsedExpander;
            col.MaxWidth = DimensionCollapsedExpander;

            // If last column, add new width to previous column if expanded
            // If first column, add new width to next column if expanded
            // Afterwards let WPF handle it
            int index = _columnWidthMap.IndexOf(_columnWidthMap[col]);
            DefinitionStorage definition = (index < _columnWidthMap.Count - 1) ? _columnWidthMap[index + 1] : _columnWidthMap[index - 1];
            ColumnDefinition  colDef     = (ColumnDefinition)definition.Definition;

            double width = _columnWidthMap[col].Actual;

            // Check if expanded
            if (colDef.MaxWidth != DimensionCollapsedExpander)
            {
                double newWidth = colDef.Width.Value + (width - DimensionCollapsedExpander);
                colDef.Width = new GridLength(newWidth, GridUnitType.Star);
            }

            col.Width = new GridLength(DimensionCollapsedExpander, GridUnitType.Star);
            CheckExploreCodeViewGrid();
        }