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
close icon

Row Height in the Grid Control

Hello All,
  I am using Data Template to display an image in a cell in the Grid.. How do I set the height of the row so the whole image is displayed...

<syncfusion:GridDataControl Grid.Row="0"
                                                x:Name="chemistryGrid"
                                                ItemsSource="{Binding}"
                                                ColumnSizer="Star"
                                                AutoPopulateColumns="False"
                                                AutoPopulateRelations="False"
                                                AllowEdit="False"
                                                AllowDragColumns="True"
                                                VisualStyle="Office14Silver"
                                                ShowAddNewRow="False">
                    <syncfusion:GridDataControl.VisibleColumns>
                        <syncfusion:GridDataVisibleColumn MappingName="Phase" HeaderText="Phase" AllowFilter="True" AllowSort="True"/>
                        <syncfusion:GridDataVisibleColumn MappingName="Header" HeaderText="Cas Number" AllowFilter="True" AllowSort="True"/>
                        <syncfusion:GridDataVisibleColumn MappingName="ImageURL" HeaderText="Structure" AllowFilter="False" AllowSort="False">
                            <syncfusion:GridDataVisibleColumn.CellItemTemplate>
                                <DataTemplate>
                                        <Image Source="{Binding CellBoundValue}" Width="80" Height="80" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </DataTemplate>
                            </syncfusion:GridDataVisibleColumn.CellItemTemplate>
                        </syncfusion:GridDataVisibleColumn>
                        <syncfusion:GridDataVisibleColumn MappingName="CrossTargetsStrings" HeaderText="Cross Targets" AllowFilter="False" AllowSort="False"/>
                    </syncfusion:GridDataControl.VisibleColumns>
                </syncfusion:GridDataControl>


Thanks,
Ravi

1 Reply

RA Rajasekar Syncfusion Team July 5, 2012 11:43 AM UTC

Hi Ravi,

 

You cannot predicate the number of controls and its size inside the DataTemplate cells, so we can’t set the height which fits all the controls in the DataTemplate cell of the particular cell. However, you can change the height of the Grid Rows by using the below code,

 

 this.dataGrid.Model.RowHeights[e.Style.RowIndex] = 100;

 

The above case can be done in the applied the GridDataControl.Loaded event by iterating the underlying collection values or Row/Column Index.

 

Please let us know if you have any queries.

 

Thanks,

Rajasekar


Loader.
Live Chat Icon For mobile
Up arrow icon