Home Forums WPF controls Xceed DataGrid for WPF How set colomn width size "Auto"

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

    <xcdg:Column FieldName=”Number” VisiblePosition=”1″ Width=”150″/>

    Width must be “Auto”

    Imported from legacy forums. Posted by SkyFox (had 501 views)

    Xceed Support
    Member
    Post count: 5658

    To get the equivalent of “Auto” (column does not derive from FrameworkElement), you can use the column’s GetFittedWidth method to set the Width property to the “fitted” value.

    Keep in mind that because of virtualization, only the content of the elements displayed in the view port will be used to calculate the “fitted” width.

    I will add a feature request to support “Auto”

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

    User (Old forums)
    Member
    Post count: 23064

    What does return value of GetFittedWidth -1 means?
    What do you mean by “only the content of the elements displayed in the view port “?
    I have a textbox inside a column, is it counts as an element displayed in the view port?

    And one more. In what event handler I should set column’s width to it’s fitted value?

    Imported from legacy forums. Posted by SkyFox (had 336 views)

    Xceed Support
    Member
    Post count: 5658

    -1 means that the fitted width cannot be calculated. Take a look at <a href=”http://doc.xceedsoft.com/products/XceedWpfDataGrid/Creating%20a%20Value-changed%20Handler.html”>this example</a> it will show you how to use the GetFittedWidth method in (I think) the same context you are trying to use it in.

    Elements in the view port are all the elements that are currently visible. So yes, this includes the TextBox in the column (as long as the column is visible).

    (Note, there is a glitch in the VB portion of the sample. The UpdateLayout() method is after the Sub and should be “Me.OrdersGrid.UpdateLayout()” (before the For Each that sets the width).

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

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