Home Forums WPF controls Xceed DataGrid for WPF Auto-sizing columns…

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

    I’m using version 1.2 of the wpf datagrid and I’m simply trying to auto-size my columns. For instance, I have three rows in a grid I’m testing with and the second row has the largest value in it’s second column compared to the second columns of the other rows. I want my column to auto-size based on the size of the string in the second column. I’ve used countless grids where this was trivial, however, I can’t seem to pull it off with the wpf datagrid. I tried looping over the columns and resizing based on the value returned from the column.GetFittedWidth() method. However, each time I receive -1 from that method. I read another post that said to call UpdateLayout() on the grid before attempting to use the GetFittedWidth() method…however…I still received a -1 from GetFittedWidth. Am I missing something? This should be a trivial feature guys…

    Imported from legacy forums. Posted by Corey (had 2037 views)

    User (Old forums)
    Member
    Post count: 23064

    I wanted to make a correction. “I read another post that said to call UpdateLayout() on the grid before setting the ItemsSource property…and then GetFittedWidth() would work property.” This should have been my comment instead of, “I read another post that said to call UpdateLayout() on the grid before attempting to use the GetFittedWidth() method.”

    Thanks,

    Corey

    Imported from legacy forums. Posted by Corey (had 2993 views)

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