First xamarin app...testing the android...looking at the treeview example on https://github.com/danvanderboom/Xamarin-Forms-TreeView
Would like to include an image through binding into the treeview node... Ive got the image displaying through binding from how to display an image on xamarin forms using binding tag from image its when I try to include it in the treeview where it isnt working....so far
so looking at HighEnergy.TreeView.Demo(Portable) -> Demo Module folder.
In DemoTreeNode.cs I have added
string _ImagePath = string.Empty;
public string ImagePath
{
get { return _ImagePath; }
set { Set("Image", ref _ImagePath, value); }
}
in DemoTreeViewModel had edited the tree node to include image...
MyTree = new DemoTreeNode { Title = "Root", ImagePath= "champagne.jpg", Score = 0.5, IsExpanded = true };
In DemoTreeCardView.xaml I have included the image tag just after the title:
<Label x:Name="TitleLabel" Text="{Binding Title}" Font="Bold,20" TextColor="Black" VerticalOptions="Center" HorizontalOptions="Start"/>
<Image Source="{Binding ImagePath}" />
then in the DemoTreeCardView code behind I have included the bindingContext()
namespace HighEnergy.TreeView.Demo
{
public partial class DemoTreeCardView : ContentView
{
public DemoTreeCardView()
{
InitializeComponent();
this.BindingContext = this;
}
}
}
The image champagne.jpg is located in the Andriod project -> Resources -> drawable -> champagne.jpg and is set to andriodResource for build action
any help would be great thanks