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
1280
Window Autosize with XamGrid
posted

Hello everybody,

I have the feeling that this is a very basic and stupid question, but I am having hard time anyway... so

I have a window hosting a XamGrid. I am setting the columns. This is the very simple declaration

<ig:XamGrid x:Name="dataGrid" AutoGenerateColumns="False" ItemsSource="{Binding Path=Properties_w}" ColumnWidth="Auto">
<ig:XamGrid.ColumnResizingSettings>
<ig:ColumnResizingSettings AllowCellAreaResizing="True" AllowColumnResizing="Disabled"/>
</ig:XamGrid.ColumnResizingSettings>
<ig:XamGrid.Columns>
<ig:TextColumn Key="PropertyName" HeaderText="{locExt:Localizer prop}"/>
<ig:TextColumn Key="Category" HeaderText="{locExt:Localizer category}"/>
<ig:TextColumn Key="SubscribedTo" />
<ig:TextColumn Key="DataType" />
<ig:TextColumn Key="Units" />
<ig:TextColumn Key="UserAccess" />
<ig:TextColumn Key="ConstraintStatus" Width="*"/>
</ig:XamGrid.Columns>
</ig:XamGrid>

As you can see, I set Auto for every column's width, except for the last one (*) which will take all available space.

I simply want my window to adapt to the width of the grid.

How can i do that?
 If I set Width="Auto" the window will (don't know why) grow more than necessary. If I set a constant number (e.g. Width="500")  the window won;t resize (scrollbars will appear). If I set SizeToContent="Width" the window will grow, grow grow...

Why is that so hard:? What am I missing?

The window will simply host this grid and I want it to have the proper size

PS: I am using XamGrid, but if you have a suggestion for XamDataGrid I can use it, no problem

Thanks in advance!