Home Ask Login Register

Developers Planet

Your answer is one click away!

mauro21pl February 2016

WPF more then one DataTrigger

Would you know why the XAML below is not working. It looks like I can not have more than one DataTrigger for an element. Those Storyboards within DataTrigger, as you can tell are being executed on a button click. The end reason is that on a button click, one grid should slide up, and the other slide down, achieving sort of accordian animation. Thanks

           <StackPanel Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,0">
                <!--Add New Banner Grid-->
                <!--<Grid DockPanel.Dock="Top" Background="#FFE0FFD2" Height="50">-->
                <Grid x:Name="grdAddBunner">
                        <Style TargetType="Grid">
                            <Setter Property="Height" Value="50"></Setter>
                            <Setter Property="Background" Value="#FFE0FFD2"></Setter>

                                <DataTrigger Binding="{Binding ElementName=btnEditBunner, Path=IsPressed}" Value="True">
                                                <DoubleAnimation Storyboard.TargetProperty="Height" From="150" To="0" Duration="0:0:0.5"></DoubleAnimation>

                                <DataTrigger Binding="{Binding ElementName=btnAddBunner        


Edd February 2016

The "IsPressed" lets you know when the button is "active" this changes again when you release the button.

Have you tried moving this to a command binding on the button and set properties on your viewModel that those grids can use to set styles on themselves?

Post Status

Asked in February 2016
Viewed 1,153 times
Voted 11
Answered 1 times


Leave an answer

Quote of the day: live life

Devs Planet ®

2014-2016 www.devsplanet.com

Devs Planet © all rights reserved