Actually I'm using an items control and animating the children of it开发者_JAVA百科. The problem is when adding the items dynamically through Add() method the first item is not getting animated and just comes to display as usual.
I've planned to hide the dynamically added child and later make it visible when i want to use it with animation and that way i can bring it into view with animation.
To hide the child when it gets added dynamically i need some kinda of notification or event fired for Add() method!. I tried using InotifyCollectionChanged but that didn't work.
Your thoughts please.. Your alternative suggestions are also appreciated..
Thanks in advance...
First option is to check this question: Animate WPF Datatemplate when item added to Listbox?.
Another option would be to create your own ItemsControl
and override OnItemsChanged()
method. But it's not as easy as the first option.
Hope this helps.
I'd probably bind the listbox to a collection in a ViewModel, and add directly to that rather than adding to the ListBox.
Hi guys i found the solution for my problem, this may help those who are struck with such an issue.
This can be achieved by using a grid as your itemsHost and dynamically adding the children of itemscontrol to the grid and animating it. since the grid get its children only at the runtime we have more control over it and decide when it should be rendered on the screen.
精彩评论