Hi Markus,
We did have one other report of an issue with the ToggleTransitionPresenter data context "breaking". We never received a reply though, so we were no able to determine the problem.
The last change to the ToggleTransitionPresenter control was made in build 0543, which removed a call to UpdateLayout of an inner ContentPresenter (which shouldn't affect the DataContext).
There was another change to it's base class TransitionPresenter, which corrected an exception of "visual already has a parent". The TransPresenter is a ContentPresenter itself, but also leverages two internal ContentPresenters. The TransPresenter's content is effectively passed down and presented by one of these inner ContentPresenters.
The issue that was corrected was that TransPresenter would create the controls from the associated DataTemplate, even though it would never be used. In addition, the inner ContentPresenter would create the DataTemplate and actually present it. If the content is a visual (that just happens to be presented via a DataTemplate), this could result in a "visual already has a parent" exception.
Taking a simple test like so:
<StackPanel DataContext="ContextMain">
<StackPanel.Resources>
<DataTemplate x:Key="MyTemplate">
<TextBlock Text="{Binding}" />
</DataTemplate>
</StackPanel.Resources>
<ToggleButton x:Name="toggle" Content="Toggle Content" />
<ContentPresenter Content="ContextOne" ContentTemplate="{StaticResource MyTemplate}" />
<ContentPresenter DataContext="ContextTwo" Content="{Binding}" ContentTemplate="{StaticResource MyTemplate}" />
<ContentPresenter DataContext="ContextThree" Content="{Binding DataContext, RelativeSource={RelativeSource Self}}" ContentTemplate="{StaticResource MyTemplate}" />
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource MyTemplate}" />
<Separator Height="1" HorizontalAlignment="Stretch" />
<shared:ToggleTransitionPresenter IsAlternateContentVisible="{Binding IsChecked, ElementName=toggle}"
Content="ContextOne" ContentTemplate="{StaticResource MyTemplate}"
AlternateContent="AltContextOne" AlternateContentTemplate="{StaticResource MyTemplate}" />
<shared:ToggleTransitionPresenter IsAlternateContentVisible="{Binding IsChecked, ElementName=toggle}"
DataContext="ContextTwo"
Content="{Binding}" ContentTemplate="{StaticResource MyTemplate}"
AlternateContent="{Binding}" AlternateContentTemplate="{StaticResource MyTemplate}" />
<shared:ToggleTransitionPresenter IsAlternateContentVisible="{Binding IsChecked, ElementName=toggle}"
DataContext="ContextThree"
Content="{Binding DataContext, RelativeSource={RelativeSource Self}}" ContentTemplate="{StaticResource MyTemplate}"
AlternateContent="{Binding DataContext, RelativeSource={RelativeSource Self}}" AlternateContentTemplate="{StaticResource MyTemplate}" />
<shared:ToggleTransitionPresenter IsAlternateContentVisible="{Binding IsChecked, ElementName=toggle}"
Content="{Binding}" ContentTemplate="{StaticResource MyTemplate}"
AlternateContent="{Binding}" AlternateContentTemplate="{StaticResource MyTemplate}" />
<shared:ToggleTransitionPresenter IsAlternateContentVisible="{Binding IsChecked, ElementName=toggle}"
Content="{Binding}" ContentTemplate="{StaticResource MyTemplate}"
AlternateContent="AltContextFive" AlternateContentTemplate="{StaticResource MyTemplate}" />
</StackPanel>
Using the latest build, the output is:
Quote:
ContextOne
ContextMain
ContextThree
ContextMain
------------------------
ContextOne
ContextMain
ContextThree
ContextMain
ContextMain
If you press the toggle button, then you end up with:
Quote:
ContextOne
ContextMain
ContextThree
ContextMain
------------------------
AltContextOne
ContextMain
ContextThree
ContextMain
AltContextFive
So that works as expected as it matches how the ContentPresenter works and changes the content appropriately when toggled. If I use the version from build 0541 then I see the exact same results.
If you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.