
Consider a tabbed multi-document application, were the currently active document is ActiveDocViewModel. I've got a ToolWindow like:
<actidock:ToolWindow Title="3D" x:Name="Panel3D" >
<local:Panel3D DataContext="{Binding ElementName=dockSite, Path=DataContext.ActiveDocViewModel}" />
</actidock:ToolWindow>
In Panel3D, there's a listbox like:
<ListBox SelectionMode="Multiple" ItemsSource="{Binding SlicesList}" >
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding Path=IsChecked, Mode=TwoWay}"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
Everything above works as expected: the listbox shows the items in the SlicesList property, and tabs are switched, SlicesList is updated with the SlicesList property for the current document. However, if I simply wrap the ListBox in a PopupButton:
<actishared:PopupButton Content="Select" DisplayMode="Merged">
<actishared:PopupButton.PopupContent>
<ListBox>
<!--...Same as above...-->
</ListBox>
</actishared:PopupButton.PopupContent>
</actishared:PopupButton>
Suddenly, changing tabs no longer updates the SlicesList (all tabs show the same list of slices, belonging to the 1st tab). Why would wrapping the ListBox in a PopupButton break the binding in this way?
[Modified 6 years ago]