TreeView does not display items past a certain point even though the control has plenty of height
I am using a WinUI SfTreeView inside of a grid. The TreeView will only use a certain amount of height to display items even though the height is taking all available window height. I can also set the MinHeight to a ridiculously large amount and the TreeView will not use all of the height. When I expand or collapse a node, it seems to change the height that is being used to display the tree and it never displays the whole structure. If I set AutoExpandMode="AllNodes" the tree initial displays fine, but when I collapse a node the tree starts to not display after a certain point.
I put borders around the grid and SfTreeView to make sure they are the correct height, but the SfTreeView will not use all the height after you begin collapsing nodes.
Here is the code:
<Grid
BorderBrush="Green"
BorderThickness="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<treeView:SfTreeView
BorderBrush="Red"
BorderThickness="2"
Grid.Column="0" Grid.Row="1"
x:Name="TmfFolderTree"
ChildPropertyName="ChildItems"
AllowEditing="True"
SelectionMode="Single"
ShowLines="false"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsAnimationEnabled="False"
AutoExpandMode="RootNodes"
ItemTemplate="{StaticResource NodeTemplate}"
ItemsSource="{x:Bind ViewModel.TmfFolders, Mode=TwoWay}" />
</Grid>
We have analyzed your issue but would like to clarify your requirement further. It appears that you expect the TreeView items to always adjust according to the TreeView’s height. By default, each TreeView node has a height of 40, which controls how the nodes are displayed within the available height. If you wish to customize the height of the TreeView items, please refer to the relevant section in the user guide linked below.
The issues is not with the height of each item, it is with the height of the control, the entire control is not using the available height.
I created the ticket: https://support.syncfusion.com/support/tickets/727337
We regret the inconvenience. You can follow the ticket you have created for further updates.
- 3 Replies
- 3 Participants
-
JL Jason Lindemann
- May 15, 2025 07:39 PM UTC
- May 19, 2025 12:37 PM UTC