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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid - infinite height

Thread ID:





145682 Jul 3,2019 11:57 AM UTC Jul 6,2019 10:18 AM UTC WPF 3
Tags: SfDataGrid
Asked On July 3, 2019 11:57 AM UTC

I am using Syncfusion's SfDataGrid instead of standard one, but this question is more about XAML, not the control itself, I think.

So, I have a window with DataGrid. If there is for example 60 records, then the window gets really tall. I want the window not to change its size at all. And really don't know why it's happening.

This is my XAML:

        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>

    <Grid Grid.Column="0">
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        <StackPanel Margin="10,0,10,0" Grid.Row="0" DataContext="{Binding Info}">
            <TextBlock Text="Amount:"/>
            <sf:CurrencyTextBox Value="{Binding Amount}" Margin="0,0,0,10"/>
            <!-- some other controls -->

                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>

                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>

                <TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource LeftLabel}"
                <sf:UpDown Grid.Column="1" Grid.Row="0" Margin="0,0,0,5"
                           Value="{Binding Count}"/>

                <TextBlock Grid.Column="0" Grid.Row="1" Style="{StaticResource LeftLabel}"
                           Text="Year count:"/>
                <sf:UpDown Grid.Column="1" Grid.Row="1" 
                           Value="{Binding YearCount}"/>


        <Button Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,10,10,5" 
                Content="Simulate >>"
                Command="{Binding SimulateCommand}"/>

<!-- This is right part of the window with datagrid -->
    <DockPanel Grid.Column="1">
        <WrapPanel DockPanel.Dock="Top">
            <TextBlock Margin="10" Text="Total amount:" />
            <TextBlock Text="{Binding TotalAmount"/>

<!-- and the datagrid -->
        <sf:SfDataGrid AutoGenerateColumns="False"
                       ItemsSource="{Binding History}">
                <sf:GridDateTimeColumn DisplayBinding="{Binding Date}" MappingName="PaymentDay" HeaderText="Date"/>
                <sf:GridCurrencyColumn DisplayBinding="{Binding Amount}" MappingName="PayAmount" HeaderText="Amount"/>


So what is wrong with it?
(subquestion - how to format text as source code here?)

Farjana Parveen Ayubb [Syncfusion]
Replied On July 4, 2019 09:39 AM UTC

Hi Adam, 
Thank you contacting Syncfusion support. 
I have a window with DataGrid. If there is for example 60 records, then the window gets really tall. I want the window not to change its size at all. And really don't know why it's happening 
We have analyzed your query. It seems that your requirement is to restrict the height of window and this can be achieved by setting Window.Height property. Please refer to the below code snippet 
    Title="SfDataGrid Demo" 
Please refer to the sample in the below link 
Sample Link: 
Please let us know, if we misunderstood your requirement. 
Subquestion – how to format text as source code here? 
We are not clear with your requirement. We suspect that your requirement is to apply formatting for the columns in DataGrid. Please find below KB articles and UG links to know more details 
KB articles: 
UG Links: 
Could you let us know with more details on query with images/ video illustration? It will helps us to investigate further and provide earlier prompt solution. 
Farjana Parveen A 

Replied On July 5, 2019 10:38 AM UTC

Hi, thanks for answer. But is this the REAL solution? Or just workaround to a some problem? Should I always specify window height in WPF?

Farjana Parveen Ayubb [Syncfusion]
Replied On July 6, 2019 10:18 AM UTC

Hi Adam, 
We have analyzed your query. You can able set the size for the window, based on the size the window is displayed in UI. Otherwise default size is calculated and display, but this is not related to our Syncfusion controls.  
Please find the below links 
Farjana Parveen A 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon