AnimatedExpander Alternate Style

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 15 years ago by Bob
Version: 9.1.0507
I have modified the template for you Alternate Style AnimatedExpander in your sample and have got the "helpText" binding. The problem is that I have to create a new template for each different binding I need. Is there a way to make the "helpText" exposed so that I can bind when the style is applied? (hope this makes sense)

            TargetType="{x:Type shared:AnimatedExpander}">
            <Setter Property="Template">
                    <ControlTemplate TargetType="shared:AnimatedExpander">
                        <DockPanel LastChildFill="True">
                            <ToggleButton DockPanel.Dock="Left" Content="{TemplateBinding Header}"
                                    IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, 
                                    Path=IsExpanded, Mode=TwoWay}"
                                    Style="{StaticResource AnimatedExpanderToggleButtonStyle}"/>

                            <Border BorderThickness="1" BorderBrush="Transparent"
                                        Text="{Binding Source={x:Static phoenix:Text.Default},
                                        VerticalAlignment="Center" />
                                    <shared:AnimatedExpanderDecorator x:Name="content">
                                        <ContentPresenter Content="{TemplateBinding Content}"
                                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                                ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" Margin="10" />

                            <Trigger Property="IsExpanded" Value="True">
                                <Setter TargetName="content" Property="IsExpanded" Value="True" />
                                <Setter TargetName="helpText" Property="Visibility" Value="Hidden" />
What I want to do is replace the
Text="{Binding Source={x:Static phoenix:Text.Default},Path=preScaler}"
so that I can apply the binding when the STYLE is applied.


Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Bob,

You can do one of three things:

1. You can create a new custom class that derives from AnimatedExpander. You would then add a new DependencyProperty to your custom class, and reference that property in the Style. You can still apply the same style, but would need to update the TargetTypes.

2. You can use the Tag property of the AnimatedExpander as the help text. So you'd set the Tag property externally, and bind to that in your control template.

3. Create an attached property and reference that property in your control template.

Hope this helps.

Actipro Software Support

Posted 15 years ago by Bob
That was just what I needed!
The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.