/// <inheritdoc /> /// <summary> /// Requests information about a column. /// By calling this repeatedly the shell can detect how many columns there are. /// </summary> /// <param name="index">The column's zero-based index. It is an arbitrary value that is used to enumerate columns (DWORD dwIndex).</param> /// <param name="columnInfo">Information about the column (psci).</param> int IColumnProvider.GetColumnInfo(int index, ref ShellColumnInfo columnInfo) { Debug.WriteLine("[{0}] ColumnProviderBase.IColumnProvider.GetColumnInfo, index={1}", Id, index); if (!initialized) { throw new COMException("Initialize was not called"); } if (hideDesktopColumns || index >= columnInfos.Count) { return(HResults.False); // tell the shell there are no more columns. } columnInfo = columnInfos[index]; return(HResults.Ok); }
protected void RegisterColumn(Guid formatId, int propertyId, string title, uint defaultWidthInCharacters, ListViewAlignment format = ListViewAlignment.Left, ShellColumnState state = ShellColumnState.TypeString) { var columnId = new ShellColumnId { FormatId = formatId, PropertyId = propertyId }; // Note: description field is not used by the shell. var columnInfo = new ShellColumnInfo { ColumnId = columnId, Title = title, DefaultWidthInCharacters = defaultWidthInCharacters, Format = format, State = state | ShellColumnState.Extended | ShellColumnState.SecondaryUI, variantType = 0 }; // Note: VT_LPSTR/VT_BSTR works ok. Other types seems to have issues with sorting. // TODO = VT_BSTR columnInfos.Add(columnInfo); }
protected void RegisterColumn(Guid formatId, int propertyId, string title, uint defaultWidthInCharacters, ListViewAlignment format = ListViewAlignment.Left, ShellColumnState state = ShellColumnState.TypeString) { Contract.Requires(title != null); Contract.Requires(title.Length < ShellColumnInfo.MaxTitleLength); var columnId = new ShellColumnId { FormatId = formatId, PropertyId = propertyId }; // Note: description field is not used by the shell. var columnInfo = new ShellColumnInfo(); columnInfo.ColumnId = columnId; columnInfo.Title = title; columnInfo.DefaultWidthInCharacters = defaultWidthInCharacters; columnInfo.Format = format; columnInfo.State = state | ShellColumnState.Extended | ShellColumnState.SecondaryUI; // Note: VT_LPSTR/VT_BSTR works ok. Other types seems to have issues with sorting. columnInfo.variantType = 0; // TODO = VT_BSTR columnInfos.Add(columnInfo); }