
Hi,
i would like to use the TransitionContentPresenter but I have to use a TemplateSelector because the UI is somewhat dynamic.
Is this possible in any way?
Thanks in advance
Lars
Hi,
i would like to use the TransitionContentPresenter but I have to use a TemplateSelector because the UI is somewhat dynamic.
Is this possible in any way?
Thanks in advance
Lars
Hi Lars,
While the TransitioningContentPresenter control itself doesn't support a DataTemplateSelector, the content you set to it could be a ContentControl that has a DataTemplateSelector set. That would be a way to get it working how you need.
Hi i tried this:
<Style x:Name="ActiProContentControlStyle" TargetType="ContentControl">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl">
<actiProControls:TransitioningContentPresenter
x:Name="ContentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}">
<actiProControls:TransitioningContentPresenter.Transition>
<actiProControlsContentTransitions:FadedZoomContentTransition Mode="Out" />
</actiProControls:TransitioningContentPresenter.Transition>
</actiProControls:TransitioningContentPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
which ended up in showing the default view (ViewModel.ToString() in TextBox).
And I tried wrapping a ContentControl inside the TransitioningContentPresenter:
<actiProControls:TransitioningContentPresenter
x:Name="ContentPresenter"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<actiProControls:TransitioningContentPresenter.Transition>
<actiProControlsContentTransitions:FadedZoomContentTransition Mode="Out" />
</actiProControls:TransitioningContentPresenter.Transition>
<ContentControl
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{x:Bind CurrentViewModel, Mode=OneWay}"
ContentTemplateSelector="{StaticResource DefiImportTemplateSelector}" />
</actiProControls:TransitioningContentPresenter>
This shows the correct views but no transitions are beeing applied.
Lars
Hi Lars,
Right, unfortunately you would need to swap in a new ContentControl to trigger the transition because transitions only start when their child content changes (in this case your ContentControl instance would need to switch to another control). You couldn't do that purely via XAML. You'd have to new up a ContentControl in code and swap it in programmatically.
All that being said, we are adding a ContentTemplateSelector property to TransitioningContentPresenter for the next build so that you don't need to do any of the above and can use it naturally.
Please log in to a validated account to post comments.