TreeView for Xamarin.Forms – Open Source!
Posted by Dan Vanderboom on August 14, 2014
On a recent enterprise tablet app development project, I decided to use Xamarin and Xamarin.Forms to build Android and iOS apps. I’m having a blast and am delightfully productive compared to all the years I spent building enterprise mobile systems with Windows CE/Mobile.
However, a TreeView control is nowhere to be found. I decided to build my own, having committed to it in the project specs and having immediate need for it, but I didn’t want to bill my client for it. After some discussion, we agreed that I should develop the TreeView control separately as an open source library.
In the demo, tree nodes will expand or collapse when you touch them, although currently there’s no visual feedback that a button has been pushed. It scrolls, and the right side bar chart is actually part of each TreeNode’s item template.
I did some work in 2008 studying and writing about Tree data structures in .NET, and developed a simple but powerful non-binary Tree library.
Now I’m extending that library, adding a layer of ViewModel abstractions and a TreeView control to bind it to. I’ve created a GitHub repository of that Tree library as well as the spike I’ve done on the TreeView control itself, along with a working demo app.
This is a 6 hour spike, not a finished control library. But the initial prototype is working, proving the concept of its basic design. Next on the agenda are to separate out the item template of the node header from the control, add support for Xamarin.Forms data binding, define a nuget package for it, and there are a ton of features worth considering beyond the basics.
If you’re interested in contributing to this project and you’re familiar with best practices in custom control development in Xamarin.Forms, leave me a comment or email me @ dan at highenergydesign dot net. You could help shape the design direction for this basic element of enterprise user interfaces.