- Home
- Forum
- Xamarin.Forms
- Column with IsHidden= true uses width space
Column with IsHidden= true uses width space
Hi,
I have the following Grid Columns:
<sfDataGrid:SfDataGrid.Columns>
<sfDataGrid:GridTextColumn MappingName="Nr" HeaderText="Nr" ColumnSizer="Auto" />
<sfDataGrid:GridTextColumn MappingName="KeyNr" HeaderText="KeyNr." ColumnSizer="Auto"
IsHidden="{Binding Path=BindingContext.ShowAlternateKey, Source={x:Reference Name=MyPageName},Converter={StaticResource InverseBoolConverter}}"/>
<sfDataGrid:GridTextColumn MappingName="KeyNrAlternate" HeaderText="KeyNr" ColumnSizer="Auto"
IsHidden="{Binding Path=BindingContext.ShowAlternateKey, Source={x:Reference Name=MyPageName}}"/>
<sfDataGrid:GridTextColumn MappingName="Description" HeaderText="Description" ColumnSizer="LastColumnFill" />
<sfDataGrid:GridTextColumn MappingName="NotAlternateCol" HeaderText="" ColumnSizer="Auto" MinimumWidth="50"
IsHidden="{Binding Path=BindingContext.ShowAlternateKey, Source={x:Reference Name=MyPageName},Converter={StaticResource InverseBoolConverter}}" />
<sfDataGrid:GridNumericColumn AllowEditing="False" MappingName="Count" HeaderText="Count"
ColumnSizer="Auto" NumberDecimalDigits="0" MinimumWidth="100"
LoadUIView="True" />
<sfDataGrid:GridNumericColumn MappingName="WeightSum" NumberDecimalDigits="3" HeaderText="Weight" ColumnSizer="Auto"
MinimumWidth="100" />
</sfDataGrid:SfDataGrid.Columns>
The Grid should expand the whole page width. HorizontalOptions="FillAndExpand" is set on the Grid itself. The Description Column should expand empty space.
Showing and hinding the columns is working fine.
The problem ist that the hidden columns are taking their width so the grid isn't expanding over the full page width.
I'm also hiding data by the IsSelected property of the object by calling a view filter after view is created.
I tried to call "this.MyDataGrid.GridColumnSizer.Refresh(true);" after the filter has been triggered but that doesn't work.
Do I miss something? Shouldn't be the width of a hidden column at 0 by default?
I don't need to change the ShowAlternateKey property at runtime, it is only set once on the page lifetime. I guess a possible solution would be to move the column definition to code behind. But I'm using heavily MVVM, so the property is living in the ViewModel only and I want to avoid code behind as much as possible.
Maybe anyone can help.
Greetings
Christopher
SIGN IN To post a reply.
6 Replies
SK
Suriya Kalidoss
Syncfusion Team
April 25, 2018 05:41 PM UTC
Hi Christopher,
Thank You for using Syncfusion Products,
We had analyzed your query. We prepared sample based on the code that you have sent and that includes three hidden columns in the sample. We confirm that the sample is working fine from our side. If your requirement deviate from us, could you please modify the below sample, so it will be easier to provide the solution faster.
We had attached working sample and image for your reference you can download it from below link
Sample link: http://www.syncfusion.
Image link: http://www.syncfusion.
Regards,
Suriya K
CS
Christopher Schulze
April 26, 2018 08:27 AM UTC
Hi,
Attachment: Sample331306821_edited_7a7d7145.zip
thank you for the fast reply. I've successfully modified the sample to show this behavior. The package includes two screenshots of the options too.
There is one difference to my actual project: I've bound the IsHidden property to the ViewModel and the value is set once after the page is appearing and never changing during page lifetime.
In the sample I simulated that by just commenting the other option.
The same problem is visible, so it seems to be unrelated to binding the IsHidden property.
Greetings
Christopher
Attachment: Sample331306821_edited_7a7d7145.zip
CS
Christopher Schulze
April 26, 2018 08:37 AM UTC
Hi,
Attachment: Screenshots_6aead785.zip
I've created two more screenshots. It's now much more visible that the grid isn't expanding.
Greetings
Christopher
Attachment: Screenshots_6aead785.zip
SK
Suriya Kalidoss
Syncfusion Team
May 8, 2018 07:02 AM UTC
Hi Christopher,
We have checked your query. We confirm that "Grid columns does not occupy full view when hidden column's ColumnSizer is Star" is a defect and we have logged a defect report for the same. The fix for this issue will be available in our upcoming release which will be rolled out at end of May. We appreciate your patience until then.
Regards,
Suriya K
CS
Christopher Schulze
May 8, 2018 08:09 AM UTC
Hi,
thank you very much for that. This will allow to disable my workaround using two grids and hiding one of it.
Regards,
Christopher
SK
Suriya Kalidoss
Syncfusion Team
May 9, 2018 12:12 PM UTC
Hi Christopher
Thanks for the update,
Regards,
Suriya K
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
CS Christopher Schulze
- Apr 24, 2018 09:25 AM UTC
- May 9, 2018 12:12 PM UTC