1
votes

I have an image on a view and I want to create a property on ViewModel which I can bind into it. The problem is that I don’t know what type of object should I create on ViewModel. I can create a text object. I want to be able to do these:

  1. Set the source property of image ( an image from application resource)
  2. can change and resize the image during run time.
  3. set the image source to an image from hard disk.

Should I create only one object on ViewModel or can I create several objects and each of them bind to one parameter of image control?

1

1 Answers

1
votes

Create a property to each of distinct data, and bound to it. It can be either primitive types like string or int, or it can be a custom class that wrap those values. If you choose that letter option, that you also need to make sure to bind to the correct property on the custom object that you've created.