Hi!
In my silverlight app i have a view with a listbox:
<ListBox Canvas.Left="12" Canvas.Top="72" Height="468" Name="invoiceList" Width="453" ItemsSource="{Binding ElementList}" >
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
which is bound to the list of elements in my VM. The problem is that when I add new elements, one by one, using Relay Command:
public RelayCommand<Element> AddNewElement = new RelayCommand<Element>(NewElement(element));
public void NewElement(Element element)
{
if(ElementList == null) ElementList = new List<Element>();
if (element != null) ElementList.Add(element);
RaisePropertyChanged("ElementList");
}
the listbox updates only once, i.e. it shows only first element of the collection , though more items are inside ElementList