Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatic updation in longlistselector
    text
    copied!<p>I am using LongListSelector control with ItemRealized Event and its working fine but when I update the list which is assigned to ItemSource of LongListSelector the items in LongListSelector are not updating.</p> <p>Below is the code I am using in XAML.</p> <pre><code>&lt;phone:LongListSelector SelectionChanged="listBoxGroups_SelectionChanged_1" Grid.Row="1" x:Name="longListSelector" ItemTemplate="{StaticResource groupsItemTemplate}" Margin="0,100,0,0"&gt; &lt;/phone:LongListSelector&gt; </code></pre> <p>In code behind.</p> <pre><code> public GroupsMainPage() { InitializeComponent(); longListSelector.ItemRealized += longListSelector_ItemRealized; this.Loaded += GroupsMainPage_Loaded; } void longListSelector_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!controller.IsLoading &amp;&amp; longListSelector.ItemsSource != null &amp;&amp; longListSelector.ItemsSource.Count &gt;= 100) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as Result).Equals(longListSelector.ItemsSource[longListSelector.ItemsSource.Count -7])) { connectToWebService(); } } } } </code></pre> <p>After receiving the response from web service I simply do the following.</p> <pre><code>private void WebServiceSuccessAction(Object obj) { GroupModel.getInstance().GetGroupResponse((GroupResponse)obj); if (GroupModel.getInstance().GetGroupResponse().Response.errorCode == 0) { controller = new GroupController(); if (fetchNumberofGroups &lt;= 100) { this.ResultList = controller.GetGroupList(); longListSelector.ItemsSource = this.ResultList; } else { controller.addNewGroupData(); this.ResultList = controller.GetGroupList(); } } else { List&lt;Error&gt; error = ConfigModel.getInstance().getConfigResponse().Response.data.errors; foreach (Error err in error) { if (err.code == GroupModel.getInstance().GetGroupResponse().Response.errorCode) { MessageBox.Show(err.text); } } } } </code></pre>
 

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