TransitionContentPresenter with TemplateSelector?

Universal Windows Studio and Shared Library for Universal Windows Forum

Posted 2 years ago by Lars Baldes
Version: 16.1.0305
Avatar

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

Comments (3)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

Posted 2 years ago by Lars Baldes
Avatar

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

Answer - Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

The latest build of this product (v2018.1 build 0332) was released 14 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.