Hi, I found a similar post in your forum and I did write a reply there, but i realised that their usage of the xamgrid is different to mine so please see my question below:
Horizontal scroll in xamgrid causes value in unboundcolumn to be duplicated:
I am having problems with horizontal scrolling in a XamGrid, when I type into a textbox some values are being duplicated somewhere a few rows down in the grid. My XamGrid has some UnboundColumns and inside the unboundcolumns are textboxes for users to capture values into (this is done on purpose because the textboxes will contain values that are not part of the same dataset that the grid is bound to). When I click submit I can loop through the rows and read the values per row out of the textboxes and all this works fine. But unfortunately the xamgrid takes the values that I enter into the textbox in the unboundColumn and it duplicates what I my textbox value 10 rows down (what i captured in row 1, gets repeated in row 11, what I captured in row 2 gets repeated in row 12, even though the data in these rows are completely unrelated). Very bizarre!
Please see the attached xaml file. Can you provide any help to stop the grid from automatically creating duplicates?
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Nevermind, i found a solution:
There is a known problem in SILVERLIGHT: when you scroll in a datagrid some values might get randomly copied out of textboxes into other textboxes that are in a different row but in the same column when scrolling horizontally. Apparently when you scroll using the datagrid's built-in scrollbars the Row_Loading event fires and reinitialises the controls in each row, as the textboxes/checkboxes/etc get reinitialised it might be set to the value from another unrelated textbox. How annoying!
Anyway, so here is the fix:
<ScrollViewer Grid.Row="2" Height="400"> <ig:XamGrid Grid.Row="2" Height="Auto" AutoGenerateColumns="False" ... etc> </ig:XamGrid> or: <sdk:DataGrid Height="Auto" HorizontalScrollBarVisibility="False" VerticalScrollBarVisibility="False"></sdk:DataGrid></ScrollView>Doing this will replace the dodgy built-in scrolling with a separate scrolling control that does not reinitialist anything in your grid :)))