This is my ItemsControl with a simpl" /> This is my ItemsControl with a simpl" /> This is my ItemsControl with a simpl"/>

ItemsControl not showing initially, only when selecting in snoop and woosh, it's visible

60 views Asked by At
<ItemsControl x:Name="itemsRoot" ItemsSource="{Binding Path=Context.Levels, ElementName=This}" Margin="0,0,0,-5">

This is my ItemsControl with a simple Binding. The Levels prop gets filled in the Loaded-Event.

My Observation is, that after the Loaded-Event occured, only the ItemsPresenter with an empty StackPanel is in the visual tree. As soon as I use Snoop and select the ItemsControl it pops into view. I was looking a missing "PropertyChanged"-Event but I am not sure what Snoop is doing in addition to calling all Getters on the selected object. I noticed this behavior on different points in my Application. This one uses an ElementName within the binding. Not sure if it makes a difference, but is always an ItemsControl which does not get its Children build up.

Levels Prop:

public IReadOnlyCollection<MultiLevelSelectionLevel> Levels
{
    get
    {
       return this.levels;
    }
    private set
    {
       if (value != this.levels)
       {
           this.levels = value;
           OnPropertyChanged();
       }
     }
}

Context is an INotifyPropertyChanged-Object. The Loaded-handler is just: this.Context.Levels = new ReadOnlyObservableCollection<Level>(levels) and contains 3 viewmodel-instances in my test.

empty stack panel inside itemscontrol No children before selecting in snoop After selection all children are build up

0

There are 0 answers