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,
The event would only fire when cells for those columns come into view.
Have you tried scrolling them into view, and validating that it gets triggered?
Also, make sure that the code you're using to set the tag of the cell is being hit. If your binding before the grid is loaded, you'd want to loop through your rows in the loaded event.
Also, i think you might want to try the ValueConverter approach with your TextBlock, as i think it could provide a cleaner solution.
-SteveZ
So these columns are TemplateColumns that are added dynamically in code, per the example above.The controlAttached event never fires for those columns, only my other columns, which is why the Cell.Tag is always null.Do I need to do something special to get it to fire for the templatecolumns?
its null for every column. I have code like so: if (e.Cell.Tag != null)
{
put a break point inside which never gets hit. Also broke outside of it and checked a bunch of them and they are all null
Are you making sure that the cell is for the correct column?
if(e.Cell.Column.Key == "MyCol")
object val = e.Cell.Tag;
}
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.
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.