I want to set width of columns of xamgrid individually. I want all columns to use a fixed size, but last column have 1 Star width to extend to all free space.
Is this posible?
It would nice too if I can set all columns to Auto, but last column to 1 Star to extend free space.
Thanks
Hello Isidoro,
I am just checking if you require any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thank you for your post. I have been looking into the functionality that you are trying to achieve and if you are defining the columns of the XamGrid, using xaml, you can set the Width property of all columns to Auto and set the Width of the last column to star (“*”) in order to implement it. You can do that as follow:
<ig:XamGrid Name="xamGrid1" ItemsSource="{Binding}" AutoGenerateColumns="True" > <ig:XamGrid.Columns> <ig:TextColumn Key="Label" Width="Auto"/> <ig:TextColumn Key="Open" Width="Auto"/> <ig:TextColumn Key="Close" Width="Auto"/> <ig:TextColumn Key="High" Width="Auto"/> <ig:TextColumn Key="Low" Width="*"/> </ig:XamGrid.Columns> </ig:XamGrid>
If you are auto generating the columns of the XamGrid, I can suggest using the CollectionChanged event of the Columns property of the XamGrid. In the event handler you can set the newly added column’s Width to Star and set the Width of the column with index current column – 1 to Auto. This way you will have all the columns’ width set to auto and the last column will be set to star. I have created a sample application that demonstrates how you can implement this approach.
If you need any further assistance on the matter please do not hesitate to ask.