开发者

Nesting an Accordian Control has Problems Resizing Content

开发者 https://www.devze.com 2022-12-21 23:05 出处:网络
I am working on a site where I have an accordian control for the main content and in each is another accordian control.It worked fine so long as there were just a few items in there but once I got eno

I am working on a site where I have an accordian control for the main content and in each is another accordian control. It worked fine so long as there were just a few items in there but once I got enough items in the child accordian they are clipped when expanding an item. It's not so bad for items near the top of the list but for items near the end you cannot see anything because it's completely clipped.

You can see them if you collapse the main accordian control and then expand it again. (see http://www.utahcodecamp.com/#Sessions/ to see what I mean)

Any suggestions? Can I force the parent ac开发者_JAVA百科cordian item to re-calculate the size?


It looks like you may have found a bug in the Accordian implementation. You should create a very small spike with just enough in it to reproduce the problem and post it to the issues section for the Silverlight Toolkit.


I found a work-around. It works perfectly!

"a" is the inner accordian.

    void a_SizeChanged(object sender, SizeChangedEventArgs e)
    {
        var accordian = sender as AccordionItem;
        var items = accordian.GetVisualAncestors();

        foreach (DependencyObject obj in items)
        {
            if (obj is ExpandableContentControl)
            {
                ExpandableContentControl ctrl = obj as ExpandableContentControl;
                ctrl.Height += e.NewSize.Height - e.PreviousSize.Height;
            }
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号