Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
415
Scrolling causing text to change
posted

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>

I have a loop that adds date columns as follow:
   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);
Then I have code that loops through each row and sets some of the cells:
    foreach (var row in TaxonomyGrid.Rows)
                {
                       for (int i = startCell; i <= endCell; ++i)
                        {
                            CellBase cell = row.Cells[i];
                       
                                if (cell.Control != null)
                                {
                                    var tb = cell.Control.Content as TextBlock;
                                    if (tb != null)
                                    {
                                        tb.Text = "";
                                        if (cellPercentagUsed < 100)
                                            tb.Text = cellPercentagUsed + "% ";
                                        if (count > 1)
                                            tb.Text += "(" + count + ")";
                                    }
                           
                    }
                }
any thoughts???????????

Parents Reply Children
No Data