I have a grid that is setup with template columns. The template columns have a TextBlock and I am setting the values of that TextBlock for some of the cells. When I scroll up and down the values are dissappearing or transposing.
Here is some of my code to show how i am setting things up and setting the textblock values:
I have a data template defined in the xaml file:
<DataTemplate x:Key="myCellTemplate" >
<TextBlock Text="" />
</DataTemplate>
Hi,
So, the code you're using isn't going to work, b/c as you scroll cells get recycled.
The following to help articles go into detail on how this works:
http://help.infragistics.com/Help/NetAdvantage/Silverlight/2009.1/CLR3.5/html/SL_xamWebGrid_Virtualization.html
http://help.infragistics.com/Help/NetAdvantage/Silverlight/2009.1/CLR3.5/html/SL_xamWebGrid_Control_the_Virtualization_Process.html
Essentially, you just set the value when the cell control gets scrolled into view.
If you want, you can loop through the rows, store the values on the Tag property of each cell, and use the CellControlAttached event, and load your textbox with the value in the tag of the cell.
Or, you can use a ValueCoverter and a binding on the TextBlock in your DataTemplate.
-SteveZ
Stephen Zaharuk said: If you want, you can loop through the rows, store the values on the Tag property of each cell, and use the CellControlAttached event, and load your textbox with the value in the tag of the cell.
This sounds like a perfect solution for what I am doing i was already storing enough info in the tag for another reason.
BUT I added: CellControlAttached="TaxonomyGrid_CellControlAttached"
To the XamWebGrid and whenever it gets called the Tag is null, even though the code that sets it has already ran????
Any thoughts? Thank you for your help so far.