AmmyUI icon indicating copy to clipboard operation
AmmyUI copied to clipboard

Unable to set source attribute on image to Static Property

Open danhol86 opened this issue 8 years ago • 3 comments

I have tried to set the property of source using following:

                  Image {
		  Source: Data.MySource
		}

But that threw error saying Unresolved Reference. I did manage to work around it via....

                   Image {
		  Source: bind set [
			Source: Data.MySource
		  ]
		}

Not sure if this is intentional or not?

danhol86 avatar Feb 09 '18 16:02 danhol86

Setting TextBlock text worked fine though..... TextBlock { Text: Data.MySource }

danhol86 avatar Feb 09 '18 17:02 danhol86

Can you try using fully-qualified name for the Data object? Something like this:

Image {
  Source: MyApp.Data.MySource
}

Also, what are the types of Data and MySource?

ionoy avatar Feb 09 '18 17:02 ionoy

Have tried full name. Here is the class its referring to:

namespace TestAPP.ViewModel
{
   public class Data1
    {
        public const string MySource= "TestText";
    }
}

As I say, this works:

TextBlock {
 Text: Data1.MySource
}

But this doesnt

Image {
  Source: Data1.MySource
}

danhol86 avatar Feb 09 '18 19:02 danhol86