Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want develope control like accordian, for that I applies the height animation to canvas when button is click
but I have some controls in that canvas, double animation is working file the canvas height property is redusing and increasing,
but when canvas height property is reduce the child controls are not hide accroding to that canvas height,
so I want to hide that child controls as the canvas height property reducing

here is my xaml code,

XML
<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="600" Width="525">
  
    
    <Canvas Width="500" Height="450">
        <StackPanel Width="500" Height="450">
            <Button Width="500" Height="25" Click="Button_Click_1"></Button>
            <Canvas x:Name="cnvOrng" Width="500"  Background="Orange">
                <StackPanel>
                    <StackPanel>
                        <Button Style="{StaticResource type-btn}">
                            <StackPanel Orientation="Horizontal" Style="{StaticResource type-button-sp}">
                                <Image Source="Images/check.png" Style="{StaticResource check-image}"></Image>
                                <TextBlock Style="{StaticResource type-Text}">01</TextBlock>
                            </StackPanel>
                        </Button>
                        <Button Style="{StaticResource type-btn}">
                            <StackPanel Orientation="Horizontal" Style="{StaticResource type-button-sp}">
                                <Image Source="Images/check.png" Style="{StaticResource check-image}"></Image>
                                <TextBlock Style="{StaticResource type-Text}">02</TextBlock>
                            </StackPanel>
                        </Button>
                        <Button Style="{StaticResource type-btn}">
                            <StackPanel Orientation="Horizontal" Style="{StaticResource type-button-sp}">
                                <Image Source="Images/check.png" Style="{StaticResource check-image}"></Image>
                                <TextBlock Style="{StaticResource type-Text}">03</TextBlock>
                            </StackPanel>
                        </Button>
                      
                    </StackPanel>
                </StackPanel>

            </Canvas>
          
        </StackPanel>
    </Canvas>
</Window>


Thanks.
Posted
Updated 13-Feb-14 0:11am
v2
Comments
Sergey Alexandrovich Kryukov 13-Feb-14 9:15am    
Where is your animation? I cannot see anything. What control did you want to hide and what have you done to hide it?...
—SA
ExpertITM 13-Feb-14 10:58am    
Hi,
when Button_Click_1 button clicked then I have written a code for decrease the cnvOrng canvas height, its working but the child elements are still visible not sure why this happen I want to hide as all child elements
Thanks
Sergey Alexandrovich Kryukov 13-Feb-14 13:25pm    
If you really need help, you need to be able to provide the helpful information...
—SA
ExpertITM 14-Feb-14 11:48am    
hi,
I think i have exp all things, if u dont get then i exp again.
by the way i got the solution for that
thanks

1 solution

use stackpanel instead of canvas
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900