Got a view with lots of objects inside, which get their View from a DataTemplate declaration:
<DataTemplate DataType="{x:Type vm:StatusAViewModel}" >
<vw:StatusAView />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:StatusBViewModel}" >
<vw:StatusBView />
</DataTemplate>
Now I want to show a popup with its content based on the type of the data it's to contain:
<Popup AllowsTransparency="True"
IsOpen="{Binding IsPopupOpen,Mode=OneWay}"
PlacementTarget="{Binding PopupPlacementElement}" Placement="{Binding PopupPlacementMode}"
HorizontalOffset="{Binding PopupHOffset}" VerticalOffset="{Binding PopupVOffset}">
<ContentPresenter x:Name="StuckHere" Content="{Binding PopupData}" />
</Popup>
A ContentTemplateSelector on StuckHere doesn't work because it's only evaluated once and when the PopupData changes, the template isn't re-selected.
All the examples I can find rely on a default datatemplate, which I can't use in my case because I've already got a default DataTemplate for the main view, I only want this different template to affect my popup.
Any clues?