int IShellFolder2.GetDetailsOf(IntPtr pidl, uint iColumn, out SHELLDETAILS psd) { // Get the folder view columns. var columns = ((DefaultNamespaceFolderView)lazyFolderView.Value).Columns; // If details are being requested for a column we don't have, we must fail. if (iColumn >= columns.Count) { psd = new SHELLDETAILS { cxChar = 0, fmt = 0, str = new STRRET { uType = STRRET.STRRETTYPE.STRRET_WSTR, data = IntPtr.Zero } }; return(WinError.E_FAIL); } // If we have no pidl, we need the details of the column itself. if (pidl == IntPtr.Zero) { var column = columns[(int)iColumn]; // Create the column format. int format = 0; switch (column.ColumnAlignment) { case ColumnAlignment.Left: format = (int)LVCFMT.LVCFMT_LEFT; break; case ColumnAlignment.Centre: format = (int)LVCFMT.LVCFMT_CENTER; break; case ColumnAlignment.Right: format = (int)LVCFMT.LVCFMT_RIGHT; break; default: throw new ArgumentOutOfRangeException(); } // Set the column icon flag (if we have one). if (column.HasImage) { format |= (int)LVCFMT.LVCFMT_COL_HAS_IMAGES; } // TODO I have no idea why the shell details are not correctly respecting the cxChar.. // Create shell details for the column. psd = new SHELLDETAILS { fmt = format, cxChar = column.Name.Length, str = STRRET.CreateUnicode(column.Name) }; } else { // We've been asked for the details of an item. // Get the column ID. PROPERTYKEY propertyKey; ((IShellFolder2)this).MapColumnToSCID(iColumn, out propertyKey); // Get the value of an item at a column. var valueText = GetItemColumnValue(pidl, propertyKey); psd = new SHELLDETAILS { fmt = 0, // todo, currently set to 'left'. cxChar = valueText.Length, str = STRRET.CreateUnicode(valueText) }; } return(WinError.S_OK); }
int IShellFolder2.GetDetailsOf(IntPtr pidl, uint iColumn, out SHELLDETAILS psd) { // Use the ShellFolderImpl to handle the details. return(((IShellFolder2)shellFolderImpl).GetDetailsOf(pidl, iColumn, out psd)); }