Author: toshok
Date: 2006-08-10 11:29:45 -0400 (Thu, 10 Aug 2006)
New Revision: 63597
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
Log:
2006-08-10 Chris Toshok <[EMAIL PROTECTED]>
* ListControl.cs: remove the items.Clear line from BindDataItems,
as this is the first thing done by both subclasses in their
SetItemsCore overrides. Also, add a ItemChanged handler, and when
passed -1, refresh the list. This gets databinding working when
the datasource is set on the list before the datasource is
populated (as in wf-apps/ReportBuilder.)
* ComboBox.cs: remove the argument to BindDataItems. This call
should really go away, and be initiated by the ListControl code.
* ListBox.cs: same.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-08-10 15:11:20 UTC (rev 63596)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-08-10 15:29:45 UTC (rev 63597)
@@ -1,3 +1,17 @@
+2006-08-10 Chris Toshok <[EMAIL PROTECTED]>
+
+ * ListControl.cs: remove the items.Clear line from BindDataItems,
+ as this is the first thing done by both subclasses in their
+ SetItemsCore overrides. Also, add a ItemChanged handler, and when
+ passed -1, refresh the list. This gets databinding working when
+ the datasource is set on the list before the datasource is
+ populated (as in wf-apps/ReportBuilder.)
+
+ * ComboBox.cs: remove the argument to BindDataItems. This call
+ should really go away, and be initiated by the ListControl code.
+
+ * ListBox.cs: same.
+
2006-08-08 Peter Dennis Bartok <[EMAIL PROTECTED]>
* TextControl.cs (Document.ctor): Initialize caret so we don't crash
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2006-08-10 15:11:20 UTC (rev 63596)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2006-08-10 15:29:45 UTC (rev 63597)
@@ -651,7 +651,7 @@
protected override void OnDataSourceChanged (EventArgs e)
{
base.OnDataSourceChanged (e);
- BindDataItems (items);
+ BindDataItems ();
if (DataSource == null || DataManager == null) {
SelectedIndex = -1;
@@ -668,7 +668,7 @@
if (DataManager == null || !IsHandleCreated)
return;
- BindDataItems (items);
+ BindDataItems ();
SelectedIndex = DataManager.Position;
}
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2006-08-10 15:11:20 UTC (rev 63596)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2006-08-10 15:29:45 UTC (rev 63597)
@@ -747,7 +747,7 @@
protected override void OnDataSourceChanged (EventArgs e)
{
base.OnDataSourceChanged (e);
- BindDataItems (items);
+ BindDataItems ();
if (DataSource == null || DataManager == null) {
SelectedIndex = -1;
@@ -764,7 +764,7 @@
if (DataManager == null || !IsHandleCreated)
return;
- BindDataItems (items);
+ BindDataItems ();
base.Refresh ();
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
2006-08-10 15:11:20 UTC (rev 63596)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
2006-08-10 15:29:45 UTC (rev 63597)
@@ -303,10 +303,8 @@
#region Private Methods
- internal void BindDataItems (IList items)
+ internal void BindDataItems ()
{
- items.Clear ();
-
if (data_manager != null) {
SetItemsCore (data_manager.List);
}
@@ -325,8 +323,18 @@
data_manager = (CurrencyManager) BindingContext
[data_source];
data_manager.PositionChanged += new EventHandler
(OnPositionChanged);
+ data_manager.ItemChanged += new ItemChangedEventHandler
(OnItemChanged);
}
-
+
+ private void OnItemChanged (object sender, ItemChangedEventArgs
e)
+ {
+ /* if the list has changed, tell our subclass to
re-bind */
+ if (e.Index == -1)
+ SetItemsCore (data_manager.List);
+ else
+ RefreshItem (e.Index);
+ }
+
private void OnPositionChanged (object sender, EventArgs e)
{
SelectedIndex = data_manager.Position;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches