Hi All
I'm using UltraGrid v7.3 and using dataset as the datasource, there are 3 bands in my grid, they are like below:
A BA2A3 B2 B3 C2 C3 C4 C5A4A5
.
First my active row are on the C's band. When I programmatically changes cell value on C4 or C5, The active all row changes to C2 ( the first row). In the debug mode, I set a breakpoint on the grid's AfterRowActive method, I cann't see any of my code in the calling stack, and I can see an SetActiveRow method in the Infragistics code.
Infragistics.Win.UltraWinGrid.UltraGrid.FireEventInfragistics.Win.UltraWinGrid.UltraGrid.OnActiveRowChangeInfragistics.Win.UltraWinGrid.UltraGridBase.SetActiveRowInfragistics.Win.UltraWinGrid.UltraGrid.EnsureTempActiveRowAssignedInfragistics.Win.UltraWinGrid.UltraGridBase.PaintTimer_TickSystem.Windows.Forms.dll!System.Windows.Forms.Timer.OnTick
Why is this SetActiveRow is called? I'm guessing the C-band's Binding manager has been reset, it's position has been changed to 0, so the active row always change to the first row. Is there a way of getting the binding manager of the lower band?
By default, the grid synchronizes the ActiveRow with the current Position of the DotNet CurrencyManager/BindingManager. The call stack you have here seems to indicate that the grid is responding to a change in the CurrencyManager's position. So something in your code must be causing the CurrencyManager to change position.
If you don't want this synchronization to occur, you could set grid.SyncWithCurrencyManager to false.
Hi Mike, SyncCurrencyManager = false is OK, this can prevent active row sync with position property.
I'm curious about the CurrencyManager of the lower band, It seems in my application the lower band's currencyManager has been reset, the Position Property turns to 0 after my edit, so the active row always change to the first row after editing. I have look into all my code, there is no code to modify the Position property. So in what situation the CurrencyManager will be reset or its Position will be change?
awayings said:So in what situation the CurrencyManager will be reset or its Position will be change?
I'm not sure... you'd need to check with Microsoft on that. I can't see why an edit on the parent band should change the position of the CurrencyManager on the child band, but maybe there is some reason for it.
Hi Mike,
I have tried modify on parent band in a sample, but couldn't get the same result as the project.
My orignal question is can I get the CurrencyManager for the lower band? If so, I can handle its PositionChanged event, then maybe I can get which code could cause its change.
Microsoft is another way, it's hard to describe the scenario.
Regards,Jason.
Hi Jason,
Yes, it's possible to get the child CurrencyManager, but I'm not sure of the exact syntax off the top of my header.
I think it's something along the lines of:
grid.BindingContext[grid.DataSource, grid.DisplayLayout.Bands[1].Key]