There are different ways to distinguish between two binding objects in a custom view depending on the specific context and requirements, but here are some common approaches:
Naming convention: Give distinct names to the two binding objects and use them consistently throughout the view code.
Type checking: Check the type of the binding object to ensure that it matches the expected type for the particular use case.
Id assignment: Assign unique IDs to the bindings objects and use them to reference each object as needed.
Tagging: Attach a tag or label to each binding object to differentiate it from others.
Contextual information: Use contextual information or metadata associated with the binding objects, such as their position or purpose in the view, to distinguish them.
Custom attributes: Define custom attributes for the view to specify the exact binding object to use in specific scenarios.
Asked: 2022-11-05 11:00:00 +0000
Seen: 13 times
Last updated: Apr 14 '21