Note that there are some explanatory texts on larger screens.

plurals
  1. POExpander View connected with NotifyCollectionChangedAction randomly expands items
    primarykey
    data
    text
    <p>In my windows phone 8 application I've created truly observable collection for noticing when item changes in collection. Here is collection code:</p> <pre><code>public class TrulyObservableCollection&lt;T&gt; : ObservableCollection&lt;T&gt; where T : INotifyPropertyChanged { public TrulyObservableCollection() : base() { CollectionChanged += new NotifyCollectionChangedEventHandler(TrulyObservableCollection_CollectionChanged); } void TrulyObservableCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (Object item in e.NewItems) { var test = item as INotifyPropertyChanged; (item as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged); } } if (e.OldItems != null) { foreach (Object item in e.OldItems) { (item as INotifyPropertyChanged).PropertyChanged -= new PropertyChangedEventHandler(item_PropertyChanged); } } } void item_PropertyChanged(object sender, PropertyChangedEventArgs e) { NotifyCollectionChangedEventArgs a = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset); OnCollectionChanged(a); } } </code></pre> <p>The situation which im going to describe happens for both controls: expander view (silverlight toolkit) and expander control (telerik controls). In my view I have list of expander views/controls. On Item tap event I would like to change something in tapped item and refresh list. Here is the code how i'm doing it:</p> <p>ViewModel:</p> <pre><code>public TrulyObservableCollection&lt;SymbolRecord&gt; Symbols {get; set;} private RelayCommand&lt;SymbolRecord&gt; tapCommand; public RelayCommand&lt;SymbolRecord&gt; TapCommand { get { return tapCommand ?? (tapCommand = new RelayCommand&lt;SymbolRecord&gt;((item) =&gt; { item.Symbol = "test"; })); } } </code></pre> <p>View:</p> <pre><code>&lt;telerikData:RadJumpList x:Name="ListControl" Grid.Row="1"IsCheckModeEnabled="False" GroupPickerItemTemplate="{StaticResource JumpListHeaderItemTemplate}" GroupHeaderTemplate="{StaticResource JumpListHeaderTemplate}" ItemsSource="{Binding Path=Symbols}" &gt; &lt;telerikData:RadJumpList.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel&gt; &lt;toolkit:ExpanderView ItemsSource="{Binding}" Expander="{Binding}" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" ExpanderTemplate="{StaticResource ExpanderControlContentTemplate}" &gt; &lt;toolkit:ExpanderView.Items&gt; &lt;TextBox Text="TEST"&gt;&lt;/TextBox&gt;&lt;/toolkit:ExpanderView.Items&gt; &lt;/toolkit:ExpanderView&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/telerikData:RadJumpList.ItemTemplate&gt; &lt;/telerikData:RadJumpList&gt; &lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="ItemTap" SourceName="ListControl" &gt; &lt;cmd:EventToCommand Command="{Binding TapCommand}" CommandParameter="{Binding SelectedItem, ElementName=ListControl}" /&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; </code></pre> <p>When I click on item in emulator the property Symbol is changing but what's more <strong>random items are being expanded</strong>. Dont know why this is happening. Please help me</p>
    singulars
    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