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