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

Set Item Height of SfTreeNavigator Items To Fit Content

Hi,

I am working on an app that I am needing to utilise the SfTreeNavigator, but I need the height of the items to fit the contents (2, 3, 4 or sometimes 5 lines of text). I have tried looking in the styles and templates used by the control, but so far setting any of the height, margin or padding properties does not seem to help.

Any idea how I can accomplish this?

Thanks in advance.


3 Replies

VJ Victory Jessie Selvam D Syncfusion Team January 23, 2014 11:04 AM UTC

Hi Arjay,

 

Thanks for using Syncfusion products.

 

We have prepared a sample and tried to meet your requirement. In the sample, we have set Height="auto" for individual SfTreeNavigator items so that TreeNavigatorItem will occupy the height equal to its content in TreeNavigator.

 

Please let us know whether the provided sample meets your requirement.

 

Regards,

Victory D



TreeNavigator_115571_1da621c5.zip


MB Matt Barnes January 30, 2014 11:34 PM UTC

Thanks for the sample, it shows that what I am needing to do is possible, however I have tried adapting the sample to work with using templates/bindings and the height doesn't seem to adjust to fit the height of the header.

At the moment, I am using the HierarchicalDataTemplate to be able to have all the SfTreeNavigatorItem items be able to click through and list their children. Using the sample you provided the height was not affected and setting the AccentBrush had no affect. I have included a sample of my current XAML and basic details of the class I am binding to below.

<sf:SfTreeNavigator x:Name="sfTreeNav"


NavigationMode="Extended"


VerticalAlignment="Top"


HorizontalAlignment="Stretch"


Background="Transparent"


BorderBrush="Transparent"


BorderThickness="0"


ScrollViewer.VerticalScrollMode="Disabled"


Margin="0,0,24,0"


ItemsSource="{Binding Employees}"


<sf:SfTreeNavigator.ItemTemplate>


<sfprimitives:HierarchicalDataTemplate ItemsSource="{Binding Path=Jobs}" Template="{StaticResource BasicDataTemplate}" />


</sf:SfTreeNavigator.ItemTemplate>


</sf:SfTreeNavigator>

The class I am binding to is an ObservableCollection with a string and another ObservableCollection as properties.



SB Suresh B Syncfusion Team January 31, 2014 12:28 PM UTC

Hi Arjay,

We are able to reproduce the reported issue 'Set Item Height of SfTreeNavigator Items To Fit Content' and we have logged a bug report. The fix for this issue will be available in our upcoming Release which is scheduled to be released by 27th March 2014. Please visit our website periodically for update regarding releases.
 
Please let us know if you have any queries.

Regards,
Suresh B

Loader.
Live Chat Icon For mobile
Up arrow icon