Visibility via binding is not triggered for elements inside ListView item templates
See original GitHub issueThe scenario: We have a ListView or RadListView with similar item template
<StackLayout height="80" class="m-10 p-10" backgroundColor="gray" orientation="vertical">
<Label text="{{ id + ' tap to change the visibility of the second label'}} " backgroundColor="white"/>
<Label text="{{ name }}" visibility="{{ status+id ? 'visible' : 'collapsed' }}" backgroundColor="blue"//>
</StackLayout>
On itemTap, we are changing the boolean status to true. The binding is set successfully - however, the Label remains collapsed.
Test application to fully reproduce this case can be found here.
Steps to reproduce:
- open the application - a ListView will load showing only the first Label from each item template.
- on
itemTapthe visibility should change tovisible,but in fact, it will remaincollapsed.
Reported via t.1114737
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Visibility binding to ListboxItems inside template - Stack Overflow
I'm trying to change the Visibility of elements inside a ListBoxItem by clicking on a CheckBox outside the ListBox which contains Items, but...
Read more >Visibility via binding is not triggered for elements inside ListView ...
The scenario: We have a ListView or RadListView with similar item template <StackLayout height="80" class="m-10 p-10" backgroundColor="gray" ...
Read more >ListView Styles and Templates - WPF .NET Framework
Review a list of topics describing the styles and templates available for use with ListView control.
Read more >Element: <oj-list-view> - Oracle Help Center
Description: The JET ListView enhances a HTML list element into a themable, ... updating observableArray in a foreach binding), is not supported.
Read more >ListView - Android Developers
A list view is an adapter view that does not know the details, such as type and ... In order to display items...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@vegeorgi , @sitefinitysteve
To change the visibility for items inside ListView item template we can create Observable objects with our desired properties and callbacks and bind directly to them. Doing that will assure that we are working with the proper context (when accessing
thisin JavaScript) in our ListView templates .In the list view item template
thisis the current item so we can create an observable object with the wanted properties and callbacks and this way we won’t need to access parent binding in order to work with a callback from the global context.With this approach, we also won’t have to worry about creating multiple unique properties for each item as we would directly access the current object.
For example:
XML file
Full demonstration application can be found here.
Note: On iOS, the list view cells won’t be remeasured dynamically when the visibility is changed (by design). That means that we can only show/hide the content via visibility but without remeasuring the item cell. On Android, by design, the cells will be remeasured.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.