public GetFilteredColumns ( View view ) : List |
||
view | View | Which view are the columns being calculate for? |
return | List |
/// <summary> /// Edit a given value /// </summary> /// <param name="context"></param> /// <param name="provider"></param> /// <param name="value"></param> /// <returns></returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { // Figure out which ObjectListView we are working on. This should be the Instance of the context. ObjectListView olv = null; if (context != null) { olv = context.Instance as ObjectListView; } if (olv == null) { //THINK: Can this ever happen? System.Diagnostics.Debug.WriteLine("context.Instance was NOT an ObjectListView"); // Hack to figure out which ObjectListView we are working on ListView.ColumnHeaderCollection cols = (ListView.ColumnHeaderCollection)value; if (cols.Count == 0) { cols.Add(new OLVColumn()); olv = (ObjectListView)cols[0].ListView; cols.Clear(); olv.AllColumns.Clear(); } else { olv = (ObjectListView)cols[0].ListView; } } // Edit all the columns, not just the ones that are visible base.EditValue(context, provider, olv.AllColumns); // Calculate just the visible columns List <OLVColumn> newColumns = olv.GetFilteredColumns(View.Details); olv.Columns.Clear(); olv.Columns.AddRange(newColumns.ToArray()); return(olv.Columns); }