Hi,
I have view built in Xaml and a viewmodel tied to the views bindingcontext. In my viewmodel I have an attribute containing the image path I'd like to have on a ToolbarItem.
Xaml:
<ContentPage.ToolbarItems>
<ToolbarItem Name="Summering" Icon="{Binding SumListIcon}" Order="Primary" Command="{Binding ToggleListsCommand}"/>
</ContentPage.ToolbarItems>
ViewModel:
public string SumListIcon {
get {
return ShowList ? "sigma.png" : "list.png";
}
}
When opening this view in the app I get an exception telling me "Xamarin.Forms.Xaml.XamlParseException: No Property of name Icon found". If I change the Icon attribute to a string instead of a binding it works.
I've also tried using ImageSource instead of string with same result.
Shouldn't it be possible to bind the icon?
Regards