diff options
3 files changed, 36 insertions, 3 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index a480dc7c154..c7247f3aa00 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,10 @@ +2006-01-04 Carlos Alberto Cortez <calberto.cortez@gmail.com> + + * ColumnHeader.cs: + * ListView.cs: Implement 2.0 ColumnHeader.DisplayIndex + property by using the internal information of the + columns order in ListView. + 2007-01-04 Jonathan Pobst <monkey@jpobst.com> * CommonDialog.cs, Cursor.cs, ErrorProvider.cs, HelpProvider.cs: diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs index c287171ebc8..807c0f6a794 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnHeader.cs @@ -170,8 +170,20 @@ namespace System.Windows.Forms [Localizable (true)] [RefreshProperties (RefreshProperties.Repaint)] public int DisplayIndex { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } + get { + if (owner == null) + return -1; + + return owner.GetReorderedColumnIndex (this); + } + set { + if (owner == null) + return; + if (value < 0 || value >= owner.Columns.Count) + throw new ArgumentOutOfRangeException ("value"); + + owner.ReorderColumn (this, value); + } } [DefaultValue (-1)] diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs index 3889c022654..f795e4df6aa 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs @@ -975,6 +975,20 @@ namespace System.Windows.Forms item_control.Width -= v_scroll.Width; } } + +#if NET_2_0 + internal int GetReorderedColumnIndex (ColumnHeader column) + { + if (reordered_column_indices == null) + return column.Index; + + for (int i = 0; i < Columns.Count; i++) + if (reordered_column_indices [i] == column.Index) + return i; + + return -1; + } +#endif ColumnHeader GetReorderedColumn (int index) { @@ -984,7 +998,7 @@ namespace System.Windows.Forms return Columns [reordered_column_indices [index]]; } - void ReorderColumn (ColumnHeader col, int index) + internal void ReorderColumn (ColumnHeader col, int index) { #if NET_2_0 ColumnReorderedEventHandler eh = (ColumnReorderedEventHandler) (Events [ColumnReorderedEvent]); |