Jquery Accordion WPF

Jquery Accordion Using WPF Animation

Animate Current Stack Panel

private void AnimateCurrentStackPanel(StackPanel pspnlCurrentPanel)
        {
            DoubleAnimation dblaCurrentStack = new DoubleAnimation();
            dblaCurrentStack.From = 0;
            dblaCurrentStack.To = dblStackPanelHeight;
            dblaCurrentStack.Duration = new Duration(TimeSpan.FromMilliseconds(200));
            Storyboard strbCurrentStoryBoard = new Storyboard();
            strbCurrentStoryBoard.Children.Add(dblaCurrentStack);
            Storyboard.SetTarget(dblaCurrentStack, pspnlCurrentPanel);
            Storyboard.SetTargetProperty(dblaCurrentStack, new PropertyPath(StackPanel.HeightProperty));
            if (spnlPreviousStackPanel != null)
                AnimatePreviouseStackPanel();
            strbCurrentStoryBoard.Begin();
            spnlPreviousStackPanel = pspnlCurrentPanel;
        }



Animate Previous Stack Panel
private void AnimatePreviousStackPanel()
        {
            DoubleAnimation dblaPreviouseStack = new DoubleAnimation();
            dblaPreviouseStack.From = dblStackPanelHeight;
            dblaPreviouseStack.To = 0;
            dblaPreviouseStack.Duration = new Duration(TimeSpan.FromMilliseconds(200));
            Storyboard strbPreviousStoryBoard = new Storyboard();
            strbPreviousStoryBoard.Children.Add(dblaPreviouseStack);
            Storyboard.SetTarget(dblaPreviouseStack, spnlPreviousStackPanel);
            Storyboard.SetTargetProperty(dblaPreviouseStack, new PropertyPath(StackPanel.HeightProperty));
            strbPreviousStoryBoard.Begin();
        }

Download Code here
Jquery Accordion WPF Jquery Accordion WPF Reviewed by Bhaumik Patel on 8:04 AM Rating: 5