Setting properties on panels in a switchpanel

Views for WPF Forum

Posted 14 years ago by Robert Croshere
Version: 10.2.0531
Avatar
Hi,

I have a SwitchPanel with two different panels in it. On one panel I want to apply a ScaleTransform. If I add this directly to the panel, nothing happens, but if I add it to the outer SwtichPanel it works. However, I only want the transform to be applied to one panel, not to both. How do I get this to work?

For clarfication, this works:

<ItemsPanelTemplate>
<views:SwitchPanel
ActiveIndex="{Binding Settings.AutoScale, Converter={StaticResource BooleanToIntegerConverter}}">
<views:SwitchPanel.LayoutTransform>
<ScaleTransform
ScaleX="{Binding Path=Settings.ZoomLevel}"
ScaleY="{Binding Path=Settings.ZoomLevel}" />
</views:SwitchPanel.LayoutTransform>
<views:SwitchPanel.Panels>
<views:AnimatedWrapPanel
Orientation="Horizontal">
</views:AnimatedWrapPanel>
<views:AnimatedWrapPanel
Orientation="Vertical">
</views:AnimatedWrapPanel>
</views:SwitchPanel.Panels>
</views:SwitchPanel>
</ItemsPanelTemplate>

While this doesn't:

<ItemsPanelTemplate>
<views:SwitchPanel
ActiveIndex="{Binding Settings.AutoScale, Converter={StaticResource BooleanToIntegerConverter}}">
<views:SwitchPanel.Panels>
<views:AnimatedWrapPanel
Orientation="Horizontal">
<views:AnimatedWrapPanel.LayoutTransform>
<ScaleTransform
ScaleX="{Binding Path=Settings.ZoomLevel}"
ScaleY="{Binding Path=Settings.ZoomLevel}" />
</views:AnimatedWrapPanel.LayoutTransform>
</views:AnimatedWrapPanel>
<views:AnimatedWrapPanel
Orientation="Vertical">
</views:AnimatedWrapPanel>
</views:SwitchPanel.Panels>
</views:SwitchPanel>
</ItemsPanelTemplate>

Regards,
Robert

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Robert,

The panels used in the SwitchPanel.Panels collection are only used for their layout logic, they are not used in the visual tree. You would need to dynamically switch the SwitchPanel.LayoutTransform based on the ActiveIndex, based on where the panel you want to scale is located.

You may be able to bind the SwitchPanel.LayoutTransform like so "{Binding ActivePanel.LayoutTransform, RelativeSource={RelativeSource Self}}".


Actipro Software Support

The latest build of this product (v24.1.2) was released 7 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.