Home Forums WPF controls Xceed DataGrid for WPF Column Resize

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #26941 |

    I have a table with 7 columns and foreach column I set the column width to:

     private void UpdatePage()
            {
                Rect imageableArea = new Rect(pageSize);

                dataGridPageControl.Height = imageableArea.Height;
                dataGridPageControl.Width = imageableArea.Width;

                dataGridPageControl.Measure(imageableArea.Size);
                itemsHostPanel = (PrintVirtualizingStackPanel)ReportingPaginator.FindItemsHostTemplate(printDataGridControl, Panel.IsItemsHostProperty);
                itemsHostPanel.SetHorizontalOffset(horizOffset);
                itemsHostPanel.SetVerticalOffset(vertOffset);
                itemsHostPanel.InvalidateMeasure();

                dataGridPageControl.InvalidateMeasure();
                dataGridPageControl.Measure(imageableArea.Size);
                dataGridPageControl.Arrange(imageableArea);
                dataGridPageControl.UpdateLayout();

                int i = 0;
                foreach (Column col in printDataGridControl.Columns)
                {
                    printDataGridControl.Columns[i].Width = Math.Min(Math.Round(printDataGridControl.Columns[i].GetFittedWidth(),0,MidpointRounding.ToEven), pageSize.Width);
                    i++;
                }          
                dataGridPageControl.UpdateLayout();          
            }

     

    But the returned value is not right(i suppose so).The column content is showed  with dots.Something like this!! I have some bigger columns and they are showed correctly!!!

    First Column                Second Column 

    C:\Data\Sampl…          A0000000000000000000000000000001

    C:\Data\Sampl…          A0000000000000000000000000000001

    C:\Data\Sampl…          A0000000000000000000000000000001

     

    should be like this

     

    First Column                     Second Column 

    C:\Data\SampleData           A0000000000000000000000000000001

    C:\Data\SampleData           A0000000000000000000000000000001

    C:\Data\SampleData           A0000000000000000000000000000001

     

    Can you help me? 

     

    Imported from legacy forums. Posted by Cosmin (had 852 views)

    Xceed Support
    Member
    Post count: 5658

    The GetFittedWidth method will calculate the fitted width in relation to the cells that are visible in the viewport. Therefore, if you have cells a same column that have larger text but are not in the viewport, their content will not be included in the calculation of the fitted width.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 1669 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.