views:

44

answers:

1

Hello, 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

+2  A: 

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?

mattmanser