Note that there are some explanatory texts on larger screens.

plurals
  1. POListView. Check Count of Items and change Visibility
    primarykey
    data
    text
    <p>I'm developing a Winrt application using MVVM. I have a ListView with a binding to a ObservableCollection. </p> <pre><code> &lt;ListView x:Name="TestListView" ItemsSource="{Binding TestItems}" Visibility="{Binding ListVis, Converter={StaticResource BoolToVisibilityConverter}}".../&gt; </code></pre> <p>My ObservableCollection:</p> <pre><code>public class SearchResultCollection : ObservableCollection&lt;TestData&gt;, ISupportIncrementalLoading { public IAsyncOperation&lt;LoadMoreItemsResult&gt; LoadMoreItemsAsync(uint count) { var res = AsyncInfo.Run(async c =&gt; { //ask about data from server return new LoadMoreItemsResult() {Count = PAGE_SIZE}; }); return res; } } </code></pre> <p>I also have TextBox with linked RelayCommand (executes on event "TextChanged"):</p> <pre><code>Search = new RelayCommand&lt;BehaviorEventArgs&gt;((e) =&gt; { dynamic sender = e.Sender; string text = sender.Text; _searchText = text; if (string.IsNullOrEmpty(text)) { TestItems= null; return; } ListVis = false; TestItems= new SearchResultCollection(_searchService, text); ((ObservableCollection&lt;TestData&gt;)Contacts).CollectionChanged += SearchViewModel_CollectionChanged; }); void SearchViewModel_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (((ObservableCollection&lt;Contact&gt;)sender).Count != 0) { ListVis = true; } } </code></pre> <p>I'm trying to do something like <a href="https://stackoverflow.com/a/5209102/466545">https://stackoverflow.com/a/5209102/466545</a>, but when the Visibility of ListView get state Collapsed the CollectionChanged is not fired anymore. When i remove the Visibility property and check the work without it, the CollectionChanged event fires like needed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload