B
Bob DeRemer
I have a WinForm app that contains a custom Treeview and a two Panel
container controls. Selecting the tree root node displays Panel 1,
selecting any child nodes of the root displays panel 2. Both panels contain
text boxes.
The custom treeview control has a DataSource property - so I can bind my
custom object's ArrayList property. The ArrayList property, called Tests,
is simply a collection of Test objects. When I initialize the application,
and load up my custom object [w/ it's arraylist of test objects], I do the
following:
1) clear all databindings on the textboxes in the panels
2) set the CustomTreeView.DataSource property - which causes the TreeView to
be built
3) add all databindings on the textboxes in the panels
Upon initial startup and loading, my databinding appears to be working
great. I can navigate the tree nodes and the testboxes are updated in
accordingly. I do the updating in the CustomTreeView's OnAfterSelect
override - where I set the CurrencyManager.Position property to the
appropriate List item it is managing.
My problem starts when I decide I want to add a new Test object to my custom
objects ArrayList of tests. I'm having a problem updating the Position
property of the CurrencyManager on my custom TreeView. After updating the
ArrayList, I can see that the CurrencyManager's list count is incremented by
one. I can even see the new object - which is correct. But, when I select
the new node in the tree, and attempt to assign it's position index to the
CurrencyManager.Position [in the OnAfterSelect method], it doesn't do
anything. I can see that the CM's count is one larger than the value I am
trying to set, but it's as if there's an internal counter that ignores my
new value. The Position stays at whatever it is currently.
I have tried getting the CM and doing a refresh, calling
SuspendBinding/REsumeBinding, setting the Datasource property to null/then
back - all to no avail. I hope this is operator error, but I cannot seem to
find anything that works.
Thanks in advance for any suggestions,
Bob
container controls. Selecting the tree root node displays Panel 1,
selecting any child nodes of the root displays panel 2. Both panels contain
text boxes.
The custom treeview control has a DataSource property - so I can bind my
custom object's ArrayList property. The ArrayList property, called Tests,
is simply a collection of Test objects. When I initialize the application,
and load up my custom object [w/ it's arraylist of test objects], I do the
following:
1) clear all databindings on the textboxes in the panels
2) set the CustomTreeView.DataSource property - which causes the TreeView to
be built
3) add all databindings on the textboxes in the panels
Upon initial startup and loading, my databinding appears to be working
great. I can navigate the tree nodes and the testboxes are updated in
accordingly. I do the updating in the CustomTreeView's OnAfterSelect
override - where I set the CurrencyManager.Position property to the
appropriate List item it is managing.
My problem starts when I decide I want to add a new Test object to my custom
objects ArrayList of tests. I'm having a problem updating the Position
property of the CurrencyManager on my custom TreeView. After updating the
ArrayList, I can see that the CurrencyManager's list count is incremented by
one. I can even see the new object - which is correct. But, when I select
the new node in the tree, and attempt to assign it's position index to the
CurrencyManager.Position [in the OnAfterSelect method], it doesn't do
anything. I can see that the CM's count is one larger than the value I am
trying to set, but it's as if there's an internal counter that ignores my
new value. The Position stays at whatever it is currently.
I have tried getting the CM and doing a refresh, calling
SuspendBinding/REsumeBinding, setting the Datasource property to null/then
back - all to no avail. I hope this is operator error, but I cannot seem to
find anything that works.
Thanks in advance for any suggestions,
Bob