开发者

WPF Grid/WrapPanel AutoSize Animation

开发者 https://www.devze.com 2022-12-20 05:28 出处:网络
I have the following layout in WPF <grid> <row height=auto> <border> <listbox> <border?

I have the following layout in WPF

<grid>
<row height=auto>
<border>
<listbox>
<border?
</row>
<row height=*>
<othercontent>
</row>
</grid>

Using MVVM and have listbox itemsource bound. I am using a wrapPanel in the grid, and have scrolling disabled so the Grid row height will grow and shrink based on the list box contents. This is all working fine.

What I would like, is to be able to开发者_如何学JAVA animate the growing and shrinking of the listbox (or the border containing it, or the grid row that has the auto-height). What element should I be using - a trigger on SizeChanged on the border?

Also I when my ItemsSource changes, I would like my listbox items to fade out, then the resize, then the new items to fade in.

Any help much appreciated. Thanks, Chris


I think you would need to create you own WrapPanel. Perhaps there already is a 3rd party control out there that does what you want.

Not sure how this could be done. But a custom wrap panel. On size change check if there is room for item on row. If so execute storyboars that will animate the item's position.

Also take a look at visual state manager. If using fluid layout you will be able to animate stuff that doesn't animate. Like moving uielement out of a grid column to another.

Not sure if this is of any help.

0

精彩评论

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