Just add a [DefaultProperty("defaultState")] metadata tag in your CustomList, just above the "public class CustomList" line.
The only thing is, you can only have 1 DefaultProperty, and since the spark List has one already (I think), you won't be able to use their built in DefaultProperty (I think it's dataProvider, it's mxmlChildren for the SkinnableContainer).
That should do it though.
I know [DefaultProperty("defaultState")], like "dataProvider" is there in DataGrid, but I just want to define my model properties in my component, so lets say, when I define "defaultState", I can restrict to have only a single object rather having multiple e.g.
So, I want to restrict user to input only a single object value, like this:
Above "......" are the properties defined in my model class. Is it possible using Inspectable or something ?
mmm, I don't know, sorry man.
Sorry, can't be done in MXML. You can't assign attributes to
properties you aren't instantiating. So it needs to be a CustomState
that you're passing in. Or you'd need to create properties that can
proxy to the defaultState.
Thanks for your reply. By "create properties that can proxy to the defaultState." you mean, define each single property to the component and then combine them in commitProperties. I thought it should be possible by defining the type property in Inspectable Metadata tag.
The Inspectable metadata is just for tooling purposes. It's there so tools like Flash Builder will know a little extra info about the property, like what type of property the data is in, what it's default value is, etc... As far as I know, there is no "type" parameter with the Inspectable metadata (atleast I couldn't find one in the framework). Typically just category and defaultValue are defined, like: [Inspectable(category="Size", defaultValue="1.0")].
You are on the right path with the "proxy" approach. You can just define all the properties on the main object and then push them in to your CustomState object.
Thanks for your reply. For type property in Inspectable metadata tag: http://livedocs.adobe.com/flex/gumbo/html/WS2db454920e96a9e51e63e3d11c0bf680e1-7ffe.html#W S2db454920e96a9e51e63e3d11c0bf69084-7a21
It can have values like Boolean, Array, String etc. I am trying to have a custom one. But I notice that I have to close the property tag, even if it is a string or html for e.g. text property in TextInput, I have to write something like this:
But I still think, it should be there. Not sure