0
votes

I am having an issue with a directly bound ObservableCollection not updating a StackPanel when new items are added. Any initial items show up correctly. Only items that are added later on fail to display. XAML:

<ItemsControl x:Name="ImageTable" ItemsSource="{Binding Path=SystemObjectViewItems, Converter={StaticResource UIElementWrapper}}">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Grid>
                <ContentPresenter Content="{Binding Path=Value.View}"/>
            </Grid>
        </DataTemplate>
    </ItemsControl.ItemTemplate>

</ItemsControl>

I am using Prism MVVM so I am binding to my ViewModel which has a property:

public ObservableCollection<SystemObjectViewPresentationModel> SystemObjectViewItems {get; set; }

The basic converter and binding are working as can be demonstrated by the fact that my initial item displays correctly. It’s only items that are added to the collection after initial binding that do not show up. Any ideas? Thanks, Rick

1
Are you sure no exceptions are being thrown when adding items to the list or by the converter once the item is added? - opedog
Yes I am pretty sure. Besides for breaking at the unhandled exceptions handler, do you have any ideas on how to tell? - rboarman
Watch your VS output window for binding errors too. - James Cadd

1 Answers

2
votes

I'm going to take a wild guess and say it's the StaticResource you're using.

If you're not returning an ObservableCollection from it and you're not binding it to watch the original ObservableCollection changes it won't work.

Can you post the code to the converter?