Page 1 of 1

DataGrid column weird behaviour - Collapsed not working

Posted: Wed Aug 30, 2017 2:40 am
by sd1388
Hi Team,

I have to hide one column of Datagrid. it doesn't work on both simulator and browser. Please find below code snippet -
eg. - Here I have to hide "Id" so I applied collapsed but it doesn't work.

Code: Select all

<Grid Width="500" Height="300" VerticalAlignment="Top" HorizontalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="400"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="200"></RowDefinition>
        </Grid.RowDefinitions>
       
        <DataGrid x:Name="dgMain" Grid.Row="0" Grid.Column="0" Width="Auto" Height="Auto" AutoGenerateColumns="False" FontFamily="Arial" FontSize="11" >
            <DataGrid.Columns>
               <DataGridTemplateColumn  Header="Id" Visibility="Collapsed">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock x:Name="col1" Width="10" Text="{Binding Id}" HorizontalContentAlignment="Left"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="Name">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock x:Name="col2" Width="100" Text="{Binding Name}" HorizontalContentAlignment="Left"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn  Header="Email">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock x:Name="col3" Width="100" Text="{Binding Email}" HorizontalContentAlignment="Left"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn  Header="Address">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock x:Name="col4" Width="100" Text="{Binding Address}" HorizontalContentAlignment="Left"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
       
    </Grid>


Please suggest.

Thanks,
Swapnil

Re: DataGrid column weird behaviour - Collapsed not working

Posted: Thu Aug 31, 2017 6:40 am
by sd1388
Any update on this??

Re: DataGrid column weird behaviour - Collapsed not working

Posted: Fri Sep 01, 2017 9:49 am
by JS-Support @Userware
Hi,

We have reproduced the issue and expect it to be fixed within 1 week.

Thank you.
Regards,
JS-Support

Re: DataGrid column weird behaviour - Collapsed not working

Posted: Tue Sep 05, 2017 1:09 am
by Nick
I have this problem also, I resolve for the moment with set colum (Width = 0) in a function. When the issue is resolved change function code to Visibility ;)

Re: DataGrid column weird behaviour - Collapsed not working

Posted: Tue Sep 05, 2017 1:33 am
by JS-Support @Userware
Hi,

The issue is supposed to have been fixed in Beta 11.17, which was released yesterday.

Please let me know if you still encounter the issue with this new version.

Thanks.
Regards,
JS-Support