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

Auto Height in Cell

Hello! I use your SfTreeGrid control to present hierarchical data as a classic tree (only one column).
I have a question.
How can you automatically set the cell height to match the content?
For example, when I change the window width at run time.


Below is an example DataTemplate for a cell:             <DataTemplate x:Name="DrugFavouriteDataTemplate">
                <Grid  x:Name="RootGrid" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="{ThemeResource AlternativeBrush}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="90"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <CheckBox Grid.Column="0" Margin="40,10,15,0" VerticalAlignment="Center" HorizontalAlignment="Left" ToolTipService.ToolTip="Dodaj do ulubionych" Style="{StaticResource FavoriteCheckBoxStyle}" IsThreeState="False" IsChecked="{Binding IsFavourite, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                    <StackPanel x:Name="DrugGrid" Grid.Row="0" Grid.Column="1" Margin="0,0,0,5" Background="Transparent">
                        <TextBlock  HorizontalAlignment="Left" Margin="5,10,0,0" TextAlignment="Left" TextTrimming="CharacterEllipsis" MaxLines="3" TextWrapping="Wrap">
                            <Run x:Name="PrescriptionTypeTextBox" Text="{Binding PrescriptionType.ShortName, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Foreground="{ThemeResource MarkerBrush}" FontWeight="Bold" FontSize="18" />
                            <Run x:Name="DrugNameTextBox" Text="{Binding ShortName, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Foreground="{ThemeResource MarkerBrush}"  FontSize="18" />
                           
                            <Run x:Name="DrugFormTextBox" Text="{Binding DrugForm, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"  Foreground="{ThemeResource BasicBrush}" FontSize="14"/>
                        </TextBlock>
                        <TextBlock x:Name="DrugSubstsTextBox" Text="{Binding DrugSubsts, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" Foreground="{ThemeResource BasicBrush}" FontSize="14" Margin="10,0,0,0"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top"  HorizontalAlignment="Left" Margin="0,0,0,0" >
                        <ToggleButton x:Name="DrugReplacementsToggleButton"  IsChecked="False" Content="Pokaż zamienniki" FontSize="16" Margin="10,0,0,0"  Background="Transparent" Padding="0" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource BasicToggleButtonStyle}"  Visibility="{Binding Path=HasReplacements, Converter={StaticResource objectToVisibilityConverter}, UpdateSourceTrigger=PropertyChanged}"/>
                        <StackPanel  Background="{ThemeResource StrongBrush}" Visibility="{Binding IsSenior, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource objectToVisibilityConverter}}" Margin="10,0,0,0" VerticalAlignment="Top">
                            <TextBlock x:Name="SeniorTextBlock" Text="+75"  FontSize="14" TextAlignment="Center" Foreground="{ThemeResource MainBrush}" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="10,0,10,2"/>
                        </StackPanel>
                    </StackPanel>

                    <Rectangle Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Height="1" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Fill="{ThemeResource AccentBrush}" Margin="0,0,30,0"/>
                </Grid>
            </DataTemplate>
Jarek

1 Reply

FP Farjana Parveen Ayubb Syncfusion Team September 10, 2019 11:10 AM UTC

Hi Jaroslaw, 
 
Thank you for using Syncfusion controls. 
 
Currently we don’t have a support for AutoRowHeight in SfTreeGrid., So we have considered to provide support for “Autofit the row heights in TreeGrid” in UWP SfTreeGrid and logged feature request for the same. We will implement this feature in any of our upcoming release.   
  
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.  
  
Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.  
 
 
Note: The provided feedback link is private, and you need to login to view this feedback. 
 
And you have load the DataTemplate for a cell, so the height is calculated based on the size of the DataTemplate, its not calculated based on the content. 
 
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count.  
 
Regards,  
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon