We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfDataGrid slightly expands and gets cut off when a cell is clicked

Hello! I have some issues with my sfdatagrid getting cut off when a cell is clicked. It looks fine when the application is started, but once I click a cell, the sfdatagrid expands just a little and the last column gets slightly cut off. I am not sure if this is because of a setting on the sfdatagrid or the scroll viewer. The column sizer is set to 

 mMainwWindow.dataTableMain.ColumnSizer = GridLengthUnitType.Star;

Here is what the datagrid looks like at start up when a cell has not been clicked - 


This is what the sfdatagrid looks like once I click a cell and it slightly expands - 

It needs to remain using Star as the column sizer, however when I set it to GridLengthUnitType.AutoLastColumnFill, then it doesn't expand and gets cut off. I am curious if there is a way around this or if something needs to be changed.

Here is the XAML source code for my dataTableMain - 

<GroupBox Grid.Row="3" >

                                <ScrollViewer x:Name="mainTableContainer" Grid.Row="3" PreviewMouseWheel="mainTableContainer_PreviewMouseWheel" Focusable="False" Margin="10,0,0,0">

                                    <Grid>

                                        <syncfusion:SfDataGrid SelectionMode="Single" 

                                                   NavigationMode="Cell"

                                                   AllowDeleting="True"

                                                   AddNewRowPosition="Bottom"

                                                   x:Name="dataTableMain"

                                                   BorderThickness="0"

                                                   CellStyleSelector="{StaticResource styleSelector}"

                                                   SortColumnsChanging="dataTableMain_SortColumnsChanging"

                                                   SortColumnsChanged="dataTableMain_SortColumnsChanged"

                                                   HeaderTemplate="{StaticResource TheHeaderTemplate}"

                                                   AllowRowHoverHighlighting="True"

                                                   AllowSelectionOnPointerPressed="True"

                                                   AllowDraggingRows="True"

                                                   AllowDrop="True"

                                                   HeaderRowHeight="50"

                                                   SelectionChanged="dataTableMain_SelectionChanged"

                                                   CurrentCellDropDownSelectionChanged="dataTableMain_CurrentCellDropDownSelectionChanged"

                                                   CurrentCellBeginEdit="Spin_OnEdit"

                                                   >

                                        <interactivity:Interaction.Behaviors>

                                            <!--<local:SfDataGridBehavior/>-->

                                        </interactivity:Interaction.Behaviors>


                                        <syncfusion:SfDataGrid.HeaderStyle>

                                            <Style TargetType="{x:Type syncfusion:GridHeaderCellControl}">

                                                <Setter Property="Background" Value="{DynamicResource {x:Static adonisUi:Brushes.AccentBrush}}"></Setter>

                                                <Setter Property="Foreground" Value="{DynamicResource HeaderTextColor}"></Setter>

                                            </Style>

                                        </syncfusion:SfDataGrid.HeaderStyle>


                                        </syncfusion:SfDataGrid>

                                    </Grid>

                                </ScrollViewer>

                            </GroupBox>


1 Reply

SP Sreemon Premkumar Muthukrishnan Syncfusion Team February 23, 2023 05:45 PM UTC

Hi Jacob Treisch,


We have checked the reported issue with the provided details, but we are unable to reproduce the reported issue on our end. Here we have attached the tested sample. Please have a look at this. If you are still facing the reported issue, modify the attached sample based on your scenario. It will be helpful for us to proceed further.



Attachment: WPFDataGrid_Sample_80a5f240.zip

Loader.
Up arrow icon