Xamarin-Forms-TreeView
Xamarin-Forms-TreeView copied to clipboard
Multiple Root
How to add other roots ? Thank you.
did you ever figure this out?
A tree structure can only have one root, but it's possible one could write a modification that would let you pick at what level of the tree to start rendering visibly: "hide level 0, draw level 1 and higher", etc.
These kinds of code contributions are welcome!
HSoshiant's branch can do this. In your TreeView, define your HeaderCreationFactory as follows:
HeaderCreationFactory =
(node) =>
{
ContentView result;
if (node.Depth == 0) //do not show the root node
{
result = new ContentView();
}
else
{
result = new MyTreeCardView
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.Start
};
Debug.WriteLine("HeaderCreationFactory: new MyTreeCardView");
}
return result;
};