Example #1
0
        /// <summary>
        /// Removes all grid columns, and cleans up any associated event handlers
        /// </summary>
        private void ClearGridColumns()
        {
            if (refColWidget != null)
            {
                refColWidget.SizeAllocated -= RefColWidget_SizeAllocated;
                refColWidget = null;
            }
            while (Fixedcolview.Columns.Length > 0)
            {
                TreeViewColumn col = Fixedcolview.GetColumn(0);
                foreach (CellRenderer render in col.Cells)
                {
                    if (render is CellRendererText)
                    {
                        CellRendererText textRender = render as CellRendererText;
                        col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
                    }
                }

                Fixedcolview.RemoveColumn(Fixedcolview.GetColumn(0));
            }
            while (Grid.Columns.Length > 0)
            {
                TreeViewColumn col = Grid.GetColumn(0);

                foreach (CellRenderer render in col.Cells)

                {
                    if (render is CellRendererText)
                    {
                        CellRendererText textRender = render as CellRendererText;
                        col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
                    }
                    else if (render is CellRendererPixbuf)
                    {
                        CellRendererPixbuf pixRender = render as CellRendererPixbuf;
                        col.SetCellDataFunc(pixRender, (CellLayoutDataFunc)null);
                    }
                    render.Dispose();
                }
                Grid.RemoveColumn(Grid.GetColumn(0));
            }
        }
        /// <summary>
        /// Removes all grid columns, and cleans up any associated event handlers
        /// </summary>
        private void ClearGridColumns()
        {
            while (Grid.Columns.Length > 0)
            {
                TreeViewColumn col = Grid.GetColumn(0);
#if NETFRAMEWORK
                foreach (CellRenderer render in col.CellRenderers)
#else
                foreach (CellRenderer render in col.Cells)
#endif
                {
                    if (render is CellRendererText)
                    {
                        CellRendererText textRender = render as CellRendererText;
                        col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
                    }
                    else if (render is CellRendererPixbuf)
                    {
                        CellRendererPixbuf pixRender = render as CellRendererPixbuf;
                        col.SetCellDataFunc(pixRender, (CellLayoutDataFunc)null);
                    }
                    render.Dispose();
                }
                Grid.RemoveColumn(Grid.GetColumn(0));
            }
            while (Fixedcolview.Columns.Length > 0)
            {
                TreeViewColumn col = Fixedcolview.GetColumn(0);
                foreach (CellRenderer render in col.GetCells())
                {
                    if (render is CellRendererText)
                    {
                        CellRendererText textRender = render as CellRendererText;
                        col.SetCellDataFunc(textRender, (CellLayoutDataFunc)null);
                    }
                }

                Fixedcolview.RemoveColumn(Fixedcolview.GetColumn(0));
            }
        }