Skip to main content
added 59 characters in body
Source Link

Add a component to the dropdown that handles this.

You initialize MyDropdown instance with desired type, for example a List of instances of class Animal. They containList contains your custom class instances: horse, cat, dog (your class, not string). The component sets the values as strings to built in DropDown.does two things then:

  1. sets the values as strings to built in DropDown.
  2. remembers the List

You can then later ask MyDropdown for 2nd value and receive your own type Animal instance Cat. 

Under the hood MyComponent remembered the references your list and gives you the 2nd value from that list. This way you only have to do this once (per custom type that you want in dropdown) and can later use it semi seamlessly.

This is probably not perfect but a step in the right direction?

Add a component to the dropdown that handles this.

You initialize MyDropdown with desired type, for example a List of instances of class Animal. They contain: horse, cat, dog (your class, not string). The component sets the values as strings to built in DropDown.

You can then ask MyDropdown for 2nd value and receive your own type Animal instance Cat. Under the hood MyComponent remembered the references your list and gives you the 2nd value from that list. This way you only have to do this once (per custom type that you want in dropdown) and can later use it semi seamlessly.

This is probably not perfect but a step in the right direction?

Add a component to the dropdown that handles this.

You initialize MyDropdown instance with desired type, for example a List . List contains your custom class instances: horse, cat, dog. The component does two things then:

  1. sets the values as strings to built in DropDown.
  2. remembers the List

You can then later ask MyDropdown for 2nd value and receive your own type Animal instance Cat. 

Under the hood MyComponent remembered the references your list and gives you the 2nd value from that list. This way you only have to do this once (per custom type that you want in dropdown) and can later use it semi seamlessly.

This is probably not perfect but a step in the right direction?

Source Link

Add a component to the dropdown that handles this.

You initialize MyDropdown with desired type, for example a List of instances of class Animal. They contain: horse, cat, dog (your class, not string). The component sets the values as strings to built in DropDown.

You can then ask MyDropdown for 2nd value and receive your own type Animal instance Cat. Under the hood MyComponent remembered the references your list and gives you the 2nd value from that list. This way you only have to do this once (per custom type that you want in dropdown) and can later use it semi seamlessly.

This is probably not perfect but a step in the right direction?