Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Listbox not refreshing
    text
    copied!<p>Good Day,</p> <p>I have a WPF MVVM application that allows users to drag items into a listbox. This works successfully the first time. However, I need to have the ability to drag more items into the listbox if need be.</p> <pre><code> &lt;!-- XAML FileSelectionView.xaml --&gt; &lt;ListBox x:Name="listboxFileGroups" ItemsSource="{Binding ImportGroups, Mode=TwoWay}" SelectedItem="{Binding Path=SelectedValue, Mode=TwoWay}" Style="{StaticResource myListboxStyle}" helper:FocusExtension.IsFocused="{Binding IsImportGroupsFocused}" telerik:RadDragAndDropManager.AllowDrop="True" telerik:RadDragAndDropManager.DropInfo="OnDropInfo" telerik:RadDragAndDropManager.DropQuery="OnDropQuery" /&gt; </code></pre> <p>Here is my View Model (FileSelectionViewModel.cs) with the relevant code which does implement INotifyPropertyChanged:</p> <pre><code> // This is the data source of the top listbox private ObservableCollection&lt;string&gt; importGroups; public ObservableCollection&lt;string&gt; ImportGroups { get { System.Diagnostics.Debug.WriteLine("Retrieving Top Level Import Groups..."); importGroups = fileImportProcess.ImportGroups; return importGroups; } set { importGroups = value; fileImportProcess.ImportGroups = importGroups; System.Diagnostics.Debug.WriteLine("Initializing Top Level Import Groups..."); OnPropertyChanged("ImportGroups"); } } </code></pre> <p>FileSelectionViewModel.cs then takes these changes and propogates them into a class called FileImportProcess.cs (this also implements INotifyPropertyChanged) which looks like:</p> <pre><code> // This is the data source for FileSelection private ObservableCollection&lt;string&gt; importGroups; public ObservableCollection&lt;string&gt; ImportGroups { get { System.Diagnostics.Debug.WriteLine("Retrieving Lower Level Import Groups"); return parsedFiles.Keys.ToList().ToObservableCollection&lt;string&gt;(); } set { importGroups = value; System.Diagnostics.Debug.WriteLine("Initializing Lower Level Import Groups"); foreach (var item in importGroups) { System.Diagnostics.Debug.WriteLine("==&gt; " + item.ToString()); } OnPropertyChanged("ImportGroups"); } } </code></pre> <p>The problem that I'm having is that the first time I drag three files into the listbox, all is working correctly. When I attempt to drag more files into the listbox, the FileImportProcess.cs class acknowledges the extra files I've selected, but doesn't propogate the event back up to FileSelectionViewModel.cs. Here is my sample output:</p> <pre><code>Initializing Lower Level Import Groups ==&gt; Import Group 1 ==&gt; Import Group 2 ==&gt; Import Group 3 Retrieving Top Level Import Groups... Retrieving Lower Level Import Groups Retrieving Top Level Import Groups... Retrieving Lower Level Import Groups Retrieving Top Level Import Groups... Retrieving Lower Level Import Groups 0 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_eNodeB_Funktion_Load_M8000-10.csv 1 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_ENODEB_FUNKTION_LOAD_M8018-22.csv 2 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_ENB_Transport_Load_M8004-11.csv 3 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_EUTRAN_RELATION_HO_M8015-20.csv 4 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_EUTRANCELL_BEARER_M8007-13.csv 5 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_EUTRANCELL_ENB_HO_M8009-15.csv 6 - C:\Dropbox\Dropbox-Logs\NSN_2013_02_20_EUTRANCELL_HO_M8021-24.csv Initializing Lower Level Import Groups ==&gt; Import Group 1 ==&gt; Import Group 2 ==&gt; Import Group 3 ==&gt; Import Group 4 ==&gt; Import Group 5 ==&gt; Import Group 6 ==&gt; Import Group 7 </code></pre> <p>As you can see, the first time I drag files, the ViewModel retrieves the ImportGroups. The second time I drag additional files, I am receiving the input files, but the listbox isn't updating properly.</p> <p>EDIT*** I don't see anything in the Output window to indicate that anything is wrong with the data binding***</p> <p>Any ideas?</p> <p>TIA,</p> <p>coson</p>
 

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