Author: jordi
Date: 2005-04-22 05:50:34 -0400 (Fri, 22 Apr 2005)
New Revision: 43434

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
Log:
2005-04-22  Jordi Mas i Hernandez <[EMAIL PROTECTED]>

        * DataGridTextBoxColumn.cs: call base constructors, fixes
        * GridColumnStylesCollection.cs: missing events, methods, and 
functionality
        * GridTableStylesCollection.cs: fixes, check duplicate mapping names
        * DataGridTableStyle.cs: implements create default column styles
        * DataGridBoolColumn.cs: which types can handle
        * DataGrid.cs: missing methods, fixes, new functionality
        * DataGridColumnStyle.cs: fixes



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-04-22 08:55:18 UTC (rev 43433)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-04-22 09:50:34 UTC (rev 43434)
@@ -1,3 +1,13 @@
+2005-04-22  Jordi Mas i Hernandez <[EMAIL PROTECTED]>
+
+       * DataGridTextBoxColumn.cs: call base constructors, fixes
+       * GridColumnStylesCollection.cs: missing events, methods, and 
functionality
+       * GridTableStylesCollection.cs: fixes, check duplicate mapping names
+       * DataGridTableStyle.cs: implements create default column styles
+       * DataGridBoolColumn.cs: which types can handle
+       * DataGrid.cs: missing methods, fixes, new functionality
+       * DataGridColumnStyle.cs: fixes
+
 2005-04-20  Alexander Olk  <[EMAIL PROTECTED]>
        * FolderBrowserDialog.cs:
        - Use a thread to fill the TreeView

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs      
2005-04-22 08:55:18 UTC (rev 43433)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs      
2005-04-22 09:50:34 UTC (rev 43434)
@@ -141,8 +141,7 @@
                private Color header_forecolor;
                private Font header_font;
                private Color link_color;
-               private Color link_hovercolor;
-               private CurrencyManager currency_manager;
+               private Color link_hovercolor;          
                private Color parentrowsback_color;
                private Color parentrowsfore_color;
                private bool parentrows_visible;
@@ -161,12 +160,14 @@
                private DataGridCell current_cell;
                private Color forecolor;
                private Color backcolor;
+               private DataGridTableStyle default_style;
+               private DataGridTableStyle current_style;
                #endregion // Local Variables
 
                #region Public Constructors
                public DataGrid ()
                {
-                       styles_collection = new GridTableStylesCollection 
(this);
+                       
                        allow_navigation = true;
                        allow_sorting = true;
                        alternating_backcolor = def_alternating_backcolor;
@@ -188,8 +189,7 @@
                        header_forecolor = def_header_forecolor;
                        header_font = def_header_font;
                        link_color = def_link_color;
-                       link_hovercolor = def_link_hovercolor;
-                       currency_manager = null;
+                       link_hovercolor = def_link_hovercolor;                  
                        parentrowsback_color = def_parentrowsback_color;
                        parentrowsfore_color = def_parentrowsfore_color;
                        parentrows_visible = true;
@@ -207,8 +207,15 @@
                        forecolor = SystemColors.WindowText;
                        parentrowslabel_style = 
DataGridParentRowsLabelStyle.Both;
                        backcolor = SystemColors.Window;
-
-               }
+                       
+                       default_style = new DataGridTableStyle (true);
+                       styles_collection = new GridTableStylesCollection 
(this);
+                       styles_collection.CollectionChanged += new 
CollectionChangeEventHandler (OnTableStylesCollectionChanged);
+                       
+                       SetCurrentStyle (default_style);
+                       
+               }               
+               
                #endregion      // Public Constructor
 
                #region Public Instance Properties
@@ -609,13 +616,15 @@
 
                protected internal CurrencyManager ListManager {
                        get {
-                               return currency_manager;
+                               if (BindingContext == null) {
+                                       return null;
+                               }
+                               
+                               return (CurrencyManager) BindingContext 
[DataSource, DataMember];
                        }
 
                        set {
-                               if (currency_manager != value) {
-                                       currency_manager = value;
-                               }
+                               throw new NotSupportedException ("Operation is 
not supported.");
                        }
                }
 
@@ -853,8 +862,13 @@
 
                protected virtual DataGridColumnStyle CreateGridColumn 
(PropertyDescriptor prop)
                {
+                       return CreateGridColumn (prop, false);
+               }               
+
+               protected virtual DataGridColumnStyle CreateGridColumn 
(PropertyDescriptor prop, bool isDefault)
+               {
                        throw new NotImplementedException ();
-               }
+               }               
 
                protected override void Dispose (bool disposing)
                {
@@ -1088,6 +1102,13 @@
                {
                        base.OnPaintBackground (ebe);
                }
+               
+               protected virtual void OnParentRowsLabelStyleChanged (EventArgs 
e)
+               {
+                       if (ParentRowsLabelStyleChanged != null) {
+                               ParentRowsLabelStyleChanged (this, e);
+                       }
+               }
 
                protected virtual void OnParentRowsVisibleChanged (EventArgs e)
                {
@@ -1133,6 +1154,21 @@
                {
                        return base.ProcessDialogKey (keyData);
                }
+               
+               protected bool ProcessGridKey (KeyEventArgs ke)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               protected override bool ProcessKeyPreview (ref Message m)
+               {
+                       return base.ProcessKeyPreview (ref m);
+               }
+               
+               protected bool ProcessTabKey (Keys keyData)
+               {
+                       throw new NotImplementedException ();
+               }
 
                public void ResetAlternatingBackColor ()
                {
@@ -1324,8 +1360,37 @@
                        // Bind data
                        
                }
+                               
+               private void OnTableStylesCollectionChanged (object sender, 
CollectionChangeEventArgs e)
+               {
+                       Console.WriteLine ("Datagrid.TableStyles Collection 
Changed {0}, null {1}", e.Action,
+                               e.Element == null);
+                       /* 
+                               TODO: What's up if there are columns in the 
incoming TableStyle
+                       */
+                       
+                       switch (e.Action)  {
+                               case CollectionChangeAction.Add: {
+                                       ((DataGridTableStyle) 
e.Element).CreateColumnsForTable ();
+                                       break;
+                               }
+                               case CollectionChangeAction.Remove:
+                                       break;
+                               case CollectionChangeAction.Refresh:
+                                       break;
+                                       
+                               default:
+                                       break;
+                       }
+                       
+               }
+               
+               private void SetCurrentStyle (DataGridTableStyle style)
+               {
+                       default_style = style;
+               }
+               
 
-
                #endregion Private Instance Methods
 
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
    2005-04-22 08:55:18 UTC (rev 43433)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridBoolColumn.cs
    2005-04-22 09:50:34 UTC (rev 43434)
@@ -205,8 +205,14 @@
 
                }
                #endregion      // Public Instance Methods
+               
+               #region Private Instance Methods
+               internal static bool CanRenderType (Type type)
+               {                       
+                       return (type == typeof (Boolean));
+               }
+               #endregion Private Instance Methods     
 
-
                #region Events
                public event EventHandler AllowNullChanged;
                public event EventHandler FalseValueChanged;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
   2005-04-22 08:55:18 UTC (rev 43433)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs
   2005-04-22 09:50:34 UTC (rev 43434)
@@ -165,9 +165,9 @@
                public virtual DataGridTableStyle DataGridTableStyle {
                        get {
                                return table_style;
-                       }
+                       }                       
                }
-
+               
                protected int FontHeight {
                        get {
                                if (fontheight != -1) {
@@ -281,6 +281,12 @@
                }
 
                #endregion      // Public Instance Properties
+               
+               #region Private Instance Properties
+               internal DataGridTableStyle TableStyle {                
+                       set { table_style = value; }                    
+               }
+               #endregion Private Instance Properties
 
                #region Public Instance Methods
                protected internal abstract void Abort (int rowNum);
@@ -385,7 +391,6 @@
                        HeaderText = string.Empty;
                }
 
-
                protected internal virtual void SetColumnValueAtRow 
(CurrencyManager source, int rowNum,  object value)
                {
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
    2005-04-22 08:55:18 UTC (rev 43433)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTableStyle.cs
    2005-04-22 09:50:34 UTC (rev 43434)
@@ -31,11 +31,15 @@
 using System.ComponentModel;
 using System.Drawing;
 using System.Runtime.InteropServices;
+using System.Data;
+using System.Xml;
 
 namespace System.Windows.Forms
 {
        public class DataGridTableStyle : Component
        {
+               public static DataGridTableStyle DefaultTableStyle = new 
DataGridTableStyle (true);
+               
                #region Local Variables
                private static readonly Color           
def_alternating_backcolor = SystemColors.Window;
                private static readonly Color           def_backcolor = 
SystemColors.Window;
@@ -72,6 +76,7 @@
                private Color                           backcolor;
                private Color                           forecolor;
                private bool                            is_default;
+               CurrencyManager                         manager;
                #endregion      // Local Variables
 
                #region Constructors
@@ -92,6 +97,7 @@
                {
                        CommonConstructor ();
                        is_default = false;
+                       manager = listManager;
                }
 
                private void CommonConstructor ()
@@ -418,15 +424,21 @@
                }
 
                protected internal virtual DataGridColumnStyle CreateGridColumn 
(PropertyDescriptor prop)
-               {
-                       throw new NotImplementedException ();
+               {       
+                       return CreateGridColumn (prop,  false);
                }
-
-               // TODO: How to specify the isDefault boolean
+               
                protected internal virtual DataGridColumnStyle CreateGridColumn 
(PropertyDescriptor prop,  bool isDefault)
-               {
+               {                       
+                       if (DataGridBoolColumn.CanRenderType 
(prop.PropertyType)) {
+                               return new DataGridBoolColumn (prop, isDefault);
+                       }
+                       
+                       if (DataGridTextBoxColumn.CanRenderType 
(prop.PropertyType)) {
+                               return new DataGridTextBoxColumn (prop, 
isDefault);
+                       }
+                       
                        throw new NotImplementedException ();
-
                }
 
                protected override void Dispose (bool disposing)
@@ -690,6 +702,46 @@
                        return (selection_forecolor != def_selection_forecolor);
                }
                #endregion      // Protected Instance Methods
+               
+               #region Private Instance Properties
+               
+               // Create column styles for this TableStyle
+               internal void CreateColumnsForTable () 
+               {
+                       CurrencyManager mgr = null;                     
+                       
+                       if (manager != null) {
+                               mgr = manager;
+                       } else {
+                               if (datagrid != null) {
+                                       mgr = datagrid.ListManager;
+                               }
+                       }
+                       
+                       if (mgr == null) {
+                               return;
+                       }
+                       
+                       column_styles.Clear ();
+                       PropertyDescriptorCollection propcol = 
mgr.GetItemProperties ();                        
+                       
+                       for (int i = 0; i < propcol.Count; i++)
+                       {
+                               if (propcol[i].ComponentType.ToString () == 
"System.Data.DataRowView") {                                        
+                                       DataGridColumnStyle st = 
CreateGridColumn (propcol[i],  true);
+                                       st.MappingName = propcol[i].Name;
+                                       column_styles.Add (st);
+                               }                               
+                               
+                               // TODO: What to do with relations?
+                               if (propcol[i].ComponentType.ToString () == 
"System.Data.DataTablePropertyDescriptor") {
+                                       Console.WriteLine 
("CreateColumnsForTable::System.Data.DataTablePropertyDescriptor");
+                               }                               
+                       }
+                       
+               }
+               
+               #endregion Private Instance Properties
 
                #region Events
                public event EventHandler AllowSortingChanged;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
 2005-04-22 08:55:18 UTC (rev 43433)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs
 2005-04-22 09:50:34 UTC (rev 43434)
@@ -46,24 +46,26 @@
                        
                }
                
-               public DataGridTextBoxColumn (PropertyDescriptor prop)
+               public DataGridTextBoxColumn (PropertyDescriptor prop) : base 
(prop)
                {
-                       
+                       format = string.Empty;
                }
                
-               public DataGridTextBoxColumn (PropertyDescriptor prop,  bool 
isDefault)
+               // TODO: What is isDefault for?
+               public DataGridTextBoxColumn (PropertyDescriptor prop,  bool 
isDefault) : base (prop)
                {
                        
                }
                
-               public DataGridTextBoxColumn (PropertyDescriptor prop,  string 
format)
+               public DataGridTextBoxColumn (PropertyDescriptor prop,  string 
format) : base (prop)
                {
-                       
+                       this.format = format;                   
                }
                
-               public DataGridTextBoxColumn (PropertyDescriptor prop,  string 
format, bool isDefault)
+               // TODO: What is isDefault for?
+               public DataGridTextBoxColumn (PropertyDescriptor prop,  string 
format, bool isDefault) : base (prop)
                {
-                       
+                       this.format = format;
                }
                
                #endregion
@@ -225,6 +227,16 @@
                }
 
                #endregion      // Public Instance Methods
+               
+               
+               #region Private Instance Methods
+               
+               // We use DataGridTextBox to render everything that 
DataGridBoolColumn does not
+               internal static bool CanRenderType (Type type)
+               {                       
+                       return (type != typeof (Boolean));
+               }
+               #endregion Private Instance Methods     
 
 
                #region Events

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
    2005-04-22 08:55:18 UTC (rev 43433)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
    2005-04-22 09:50:34 UTC (rev 43434)
@@ -33,37 +33,40 @@
        {
                private ArrayList items;
                private DataGridTableStyle owner;
+               private bool fire_event;
 
                internal GridColumnStylesCollection (DataGridTableStyle 
tablestyle)
                {
                        items = new ArrayList ();
                        owner = tablestyle;
+                       fire_event = true;
                }
 
                #region Public Instance Properties
-               public DataGridColumnStyle this[string columnName] {
+               public DataGridColumnStyle this [string columnName] {
                        get {
-                               for (int i = 0; i < items.Count; i++) {
-                                       DataGridColumnStyle column = 
(DataGridColumnStyle) items[i];
-                                       if (column.MappingName == columnName) {
-                                               return column;
-                                       }
-                               }
-
-                               return null;
+                               int idx = FromColumnNameToIndex (columnName);
+                               return idx == -1 ? null : this [idx];
                        }
                }
 
-               public DataGridColumnStyle this[int index] {
+               public DataGridColumnStyle this [int index] {
                        get {
                                return (DataGridColumnStyle) items[index];
                        }
                }
 
-               [MonoTODO]
-               public DataGridColumnStyle this[PropertyDescriptor propDesc] {
-                       get {
-                               throw new NotImplementedException ();
+               
+               public DataGridColumnStyle this [PropertyDescriptor propDesc] {
+                       get {                           
+                               for (int i = 0; i < items.Count; i++) {
+                                       DataGridColumnStyle column = 
(DataGridColumnStyle) items[i];
+                                       if (column.PropertyDescriptor.Equals 
(propDesc)) {
+                                               return column;
+                                       }
+                               }
+                               
+                               return null;
                        }
                }
 
@@ -101,22 +104,34 @@
                }
 
                #endregion Public Instance Properties
+               
+               #region Private Instance Properties
+               internal bool FireEvents {
+                       get { return fire_event;}
+                       set { fire_event = value;}
+               }
+               #endregion Private Instance Properties
 
                #region Public Instance Methods
                public virtual int Add (DataGridColumnStyle column)
                {
-                       return items.Add (column);
+                       int cnt = AddInternal (column);
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Add, column));
+                       return cnt;
                }
 
                public void AddRange (DataGridColumnStyle[] columns)
                {
                        foreach (DataGridColumnStyle mi in columns)
-                               Add (mi);
+                               AddInternal (mi);
+
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Refresh, null));
                }
 
                public void Clear ()
                {
                        items.Clear ();
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Refresh , null));
                }
 
                public bool Contains (DataGridColumnStyle column)
@@ -124,10 +139,10 @@
                        return items.Contains (column);
                }
 
-               [MonoTODO]
+               
                public bool Contains (PropertyDescriptor propDesc)
                {
-                       throw new NotImplementedException ();
+                       return (this [propDesc] != null);
                }
 
                public bool Contains (string name)
@@ -147,12 +162,16 @@
 
                int IList.Add (object value)
                {
-                       return items.Add (value);
+                       int cnt = AddInternal ((DataGridColumnStyle)value);
+
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Add, null));
+                       return cnt;
                }
 
                void IList.Clear ()
                {
                        items.Clear ();
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Refresh , null));
                }
 
                bool IList.Contains (object value)
@@ -177,18 +196,77 @@
 
                void IList.RemoveAt (int index)
                {
+                       object item = items[index];
+                       
                        items.RemoveAt (index);
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Remove, item));
                }
-
-               [MonoTODO]
+               
+               public int IndexOf (DataGridColumnStyle element)
+               {
+                       return items.IndexOf (element);
+               }
+               
+               protected void OnCollectionChanged (CollectionChangeEventArgs 
ccevent)
+               {                                               
+                       if (fire_event == true && CollectionChanged != null) {
+                               CollectionChanged (this, ccevent);
+                       }
+               }
+               
+               public void Remove (DataGridColumnStyle column)
+               {
+                       items.Remove (column);
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Remove, column));
+               }
+               
+               public void RemoveAt (int index)
+               {
+                       object item = items[index];
+                       items.RemoveAt (index);
+                       OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Remove, item));
+               }               
+               
                public void ResetPropertyDescriptors ()
                {
-                       throw new NotImplementedException ();
+                       for (int i = 0; i < items.Count; i++) {
+                               DataGridColumnStyle column = 
(DataGridColumnStyle) items[i];
+                               if (column.PropertyDescriptor != null) {
+                                       column.PropertyDescriptor = null;
+                               }
+                       }
                }
 
                #endregion Public Instance Methods
 
                #region Events
-               #endregion Events
+               public event CollectionChangeEventHandler CollectionChanged;    
        
+               #endregion Events               
+               
+               #region Private Instance Methods
+               private int AddInternal (DataGridColumnStyle column)
+               {                               
+                       if (FromColumnNameToIndex (column.MappingName) != -1) {
+                               throw new ArgumentException ("The ColumnStyles 
collection already has a column with this mapping name");
+                       }
+                       
+                       column.TableStyle = owner;
+                       int cnt = items.Add (column);
+                       return cnt;                     
+               }
+               
+               private int FromColumnNameToIndex (string columnName)
+               {               
+                       for (int i = 0; i < items.Count; i++) {
+                               DataGridColumnStyle column = 
(DataGridColumnStyle) items[i];
+                               if (column.MappingName == columnName) {
+                                       return i;
+                               }
+                       }
+                       
+                       return -1;
+               }
+                               
+               #endregion Private Instance Methods
        }
 }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
     2005-04-22 08:55:18 UTC (rev 43433)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
     2005-04-22 09:50:34 UTC (rev 43434)
@@ -43,14 +43,8 @@
                #region Public Instance Properties
                public DataGridTableStyle this[string columnName] {
                        get {
-                               for (int i = 0; i < items.Count; i++) {
-                                       DataGridTableStyle column = 
(DataGridTableStyle) items[i];
-                                       if (column.MappingName == columnName) {
-                                               return column;
-                                       }
-                               }
-
-                               return null;
+                               int idx = FromColumnNameToIndex (columnName);
+                               return idx == -1 ? null : this [idx];
                        }
                }
 
@@ -97,9 +91,8 @@
 
                #region Public Instance Methods
                public virtual int Add (DataGridTableStyle column)
-               {
-                       int cnt = items.Add (column);
-
+               {                       
+                       int cnt = AddInternal (column);
                        OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Add, column));
                        return cnt;
                }
@@ -107,7 +100,7 @@
                public void AddRange (DataGridTableStyle[] columns)
                {
                        foreach (DataGridTableStyle mi in columns)
-                               items.Add (mi);
+                               AddInternal (mi);
 
                        OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Refresh, null));
                }
@@ -140,7 +133,7 @@
 
                int IList.Add (object value)
                {
-                       int cnt = items.Add (value);
+                       int cnt = AddInternal ((DataGridTableStyle)value);
 
                        OnCollectionChanged (new CollectionChangeEventArgs 
(CollectionChangeAction.Add, null));
                        return cnt;
@@ -205,7 +198,34 @@
 
                #region Events
                public event CollectionChangeEventHandler CollectionChanged;
-               #endregion Events
+               #endregion Events               
+               
+               
+               #region Private Instance Methods
+               private int AddInternal (DataGridTableStyle column)
+               {                               
+                       if (FromColumnNameToIndex (column.MappingName) != -1) {
+                               throw new ArgumentException ("The TableStyles 
collection already has a TableStyle with this mapping name");
+                       }
+                       
+                       column.DataGrid = owner;
+                       int cnt = items.Add (column);
+                       return cnt;                     
+               }
+               
+               private int FromColumnNameToIndex (string columnName)
+               {               
+                       for (int i = 0; i < items.Count; i++) {
+                               DataGridTableStyle column = 
(DataGridTableStyle) items[i];
+                               if (column.MappingName == columnName) {
+                                       return i;
+                               }
+                       }
+                       
+                       return -1;
+               }
+                               
+               #endregion Private Instance Methods
        }
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to