dotnet/winforms
Auf GitHub ansehenDiscussion/proposal: add more LVCOLUMN ComCtl 6.0 features
Open
#2.627 geöffnet am 4. Jan. 2020
api-approvedarea-controls-ListViewhelp wantedtenet-compatibility-OS
Repository-Metriken
- Stars
- (4.100 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 14T 22h) (56 gemergte PRs in 30 T)
Beschreibung
In Windows Vista, more LVCOLUMN features were added: see https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvcolumnw
Missing Features
Minimum Width
- Can set the
LVCF_MINWIDTHflag onmaskand set thecxMinvalue
Would add the following API on ColumnHeader
public class ColumnHeader
{
...
public int MinimumWidth { get; set; } = 0;
...
}
E.g.
Notice that when resizing the column its minimum width is 100 pixels

Fixed Width Columns
- Can set the
LVCF_FMTflag onmaskan set theLVCFMT_FIXED_WIDTHflag onfmt
Would add the following API on ColumnHeader
public class ColumnHeader
{
...
public bool FixedWidth { get; set; } = false;
...
}
E.g.
Notice that the column can't be resized

Split Button Columns
- Can set the
LVCF_FMTflag onmaskan set theLVCFMT_SPLITBUTTONflag onfmt
Would add the following API on ListView and ColumnHeader
public class ColumnDropDownClickEventArgs : ColumnClickEventArgs
{
public ColumnDropDownClickEventArgs(int column, Point screenLocation);
public Point ScreenLocation { get; set; }
}
public class ListView
{
...
public event ColumnDropDownClickedEventHandler ColumnDropDownClicked { add; remove; }
protected void OnColumnDropDownClicked(ColumnDropDownClickEventArgs e);
...
}
public class ColumnHeader
{
...
public bool SplitButton { get; set; } = false;
...
}
E.g.

Discussion
- Should we consolidate things like Split Button and Fixed width into a flags enum and add this as a property (e.g.
Style) onColumnHeader
[Flags]
public enum ColumnHeaderStyles
{
None,
FixedWidth = X,
SplitButton = Y
}
/cc @weltkante