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>
Was this fixed in the november/december release?
I have version 9.2 and the CellControlAttached still does not get called for my template columns that are being dynamicially added.
thanks
Hi,
The next SR is expected to be towards the end of November.
But, I definitely think you can easily make the ValueConverter approach work.
-SteveZ
The Text for the cell is currently based of information that i store in the Tag.But the information stored in the tag is based off the ColumnKey and an id for the data of a row.When is the service release expected.If its soon I could probably wait if not i could try to switch to the ValueConverter
I'm guessing that you're data for those columns, is calculated based off the data for the row, right?
In which case a ValueConverter should certainly work, you would simply have the value for the binding, be the entire data object for the row.
TextBlock Text="{Binding Converter={StaticResource MyConverter}}", note by not setting the path the source of the binding, gets set to its DataContext, which is the data for the row.
As for the event not being raised, i looked into the code, and there is a bug, where it only fires for TemplateColumns that are bound to data. I have logged an issue for it, and it should be fixed in our next ServiceRelease.
Thanks,
I have a table with 3 fixed columns, A,B,and C, and a certain number of dynamic columns, all in view.I scroll verticially which brings in many new rows. The trigger fires for columns A,B, and C but none of the dynamic columns.I am not sure I can use the valueConverter approach since I am not binding to a data object that has values for these columns.
I made sure the code setting the tag is hit, but thats irrelevent at this point since the controlAttach event isn't even firing for these columns.
Thanks for all you help so far. here is the code i am using to create the column, am i potentially setting a field that is preventing the event from firing? var tc = new TemplateColumn();
tc.ItemTemplate = (DataTemplate)Resources["myCellTemplate"];
//var tc = (TemplateColumn)Resources["TemplateColumn"];
tc.HeaderText = currentDate.Value.ToString("ddd\nMM/dd");
tc.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
//tc.HeaderStyle = App.Current.Resources["HeaderCellControlStyle1"] as Style;
tc.CellStyle = Application.Current.Resources["RedStyle"] as Style;
tc.Key = "day" + count++;
tc.IsFilterable = false;
tc.IsSortable = false;
tc.IsResizable = false;
tc.IsGroupable = false;
//tc.IsGroupBy = false;
tc.IsMovable = false;
TaxonomyGrid.Columns.Add(tc);