Exemplo n.º 1
0
        /// <summary>
        /// Set column width of a column.
        /// </summary>
        /// <param name="columnName"></param>
        /// <param name="width"></param>
        private void SetGridViewPatchesColumn(string columnName, double width)
        {
            GridViewColumnCollection columns = ((GridView)listViewPatches.View).Columns;
            // There should be always one, but El Kar has a crash about a null pointer exception, so First -> FirstOrDefault.
            GridViewColumn columnWithName = columns.FirstOrDefault(column => column.Header.ToString() == columnName);

            if (columnWithName != null)
            {
                columnWithName.Width = width;
            }
        }