Hi,
I'm new to Xamarin Forms only started a couple of weeks ago coming from a WPF / MVVM background. I have a MasterDetailPage all working without icons so I am trying to 'bind' embedded images.
So in my MenuView XAML page, I have the following:-
<ListView x:Name="lvMenu" VerticalOptions="FillAndExpand" SeparatorVisibility="None" ItemsSource="{Binding Menu}">
<ListView.ItemTemplate>
<DataTemplate>
<ImageCell Text="{Binding Title}" ImageSource="{Binding IconSource}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The Menu is just a list of MenuItems that have TargetType, Title and IconSource properties. My IconSource contains the filename of the image, ie: cog.png
The following works and does show the image (albeit the same image for all the menu options):
<ImageCell Text="{Binding Title}" ImageSource="{local:ImageResource Touchretail.Trims.Mobile.Images.cog.png}" />
So I'm pretty sure it is achievable. What I would like to do is just replace the cog.png part with the TargetType from the Menu object. Effectively - I'm trying to get to:
<ImageCell Text="{Binding Title}" ImageSource="{local:ImageResource Touchretail.Trims.Mobile.Images.{Binding IconSource}}" />
but obviously this would not work.... How can I achieve the desired result?