In my case path "MyZooSnap.Core;component/Resources/Images/i.jpg"
.
How to convert path for Android ImageView
?
In order to use it in the following binding:
{'AssetImagePath':{'Path':'ImagePath'}}
Thanks
In my case path "MyZooSnap.Core;component/Resources/Images/i.jpg"
.
How to convert path for Android ImageView
?
In order to use it in the following binding:
{'AssetImagePath':{'Path':'ImagePath'}}
Thanks
Should work also
I could not fix the problem. My MainViewModel.cs
My Converts.cs
My PathImageConverter.cs
My Setup.cs
My GameView.axml
My ItemImage.axml
/>
My UI project :
Quick answer:
assets/images/i1.png
AndroidAsset
images/i1.png
Longer answer:
Ideally your ViewModel should be platform independent and not know about View concerns.
So your ViewModel might perhaps expose a property like:
where GameState is an enumeration like:
you might then have images representing these states in an assets structure like:
where each of those files is marked with BuildAction of AndroidAsset.
To then display the correct image in the UI, you would need a value converter like:
mapped in using a Converters wrapper like:
which is configured in setup.cs using:
With this in place, then your axml binding statement would be:
For an alternative approach using resources instead of assets, see
MvxButtonIconBinding
in Іssue with binding to GridLayout to AndroidWhen the image is placed in the folder Assets and indicates simply indicate the name of the picture - it works. And when it create another folder and specify the path:
Does not work!