Support => NGUI 3 Support => Topic started by: beermoney on May 22, 2014, 10:06:37 AM
Title: property binding and read only properties
Post by: beermoney on May 22, 2014, 10:06:37 AM
Hi,
I am finding that I can't set a read only property as the source of a property binding.
ie. if the component I try use as a source has the following read only property:
publicstring LevelDescription {
get{
return"Lv."+ _Level;
}
}
LevelDescription wont appear in the dropdown in the source property binding component in the editor.
if I change it to:
publicstring LevelDescription {
get{
return"Lv."+ _Level;
}
set{}
}
then that property is now available in the dropdown of available properties and fields.
Bug or as per design? (I can imagine that it might be a requirement for bi-directional data binding but that's something I may not be using)
thanks
Title: Re: property binding and read only properties
Post by: ArenMook on May 22, 2014, 04:06:19 PM
It's by design.
Title: Re: property binding and read only properties
Post by: beermoney on May 22, 2014, 04:09:30 PM
ok
may I ask why is that is by design?
Title: Re: property binding and read only properties
Post by: ArenMook on May 22, 2014, 04:21:01 PM
Because I want the flow of data to be bi-directional. It just simplifies things.
Title: Re: property binding and read only properties
Post by: beermoney on May 22, 2014, 04:31:27 PM
just so you know it means it's extra code for everyone who doesn't need the bidirectional functionality... (and writing set{} in properties just looks messy)
also I didn't think it actually supported properties until I looked under the hood