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
980
WebGrid Columns Width
posted

Hi all,

 

I have the webgrid(ColumnWidth="*") placed inside a <Grid> , which is placed in a Border(HorizontalAlignment="Stretch" VerticalAlignment="Top"), that is presented as a page inside <navigation:Frame>

 

Now, with this situation, everything is perfect, the grid column widths are resized to fit the page width;

However, if I add a scrollview control that contains the <navigation:Frame>, the column widths are not changed at all! Even if I hardcode the ColumnWidth property of the grid;

 

How can I solve this?

Parents
  • 40030
    Suggested Answer
    Offline posted

    Hi, 

    Star column widths will only act like Auto sizing, when the xamWebGrid is given infinite width, as star sizing requires a fixed sized width in order to determine how much additional space is left.  The Grid panel behaves the exact same way. 

    If you wan't the column widths to adhere to star sizing, then you need to have a width set on the xamWebGrid, or it's parent container, in this case the Grid panel.  Or you can set the HorizontalScrollbarVisibility of the ScrollViewer to Disabled, which should give the xamWebGrid a width. 

    Note, placing the xamWebGrid in containers that give it infinite width and height could cause performance issues, as virtualization will no longer be applied. So, if you have a grid with a lot of rows or columns, then you should avoid this. 

    Hope this helps,

    -SteveZ

Reply Children
No Data