Skip to main content
Home Forums Silverlight Programming Report a Silverlight Bug Using UserControl as ItemTemplate with ItemsControl cause AccessViolationException
5 replies. Latest Post by kornfish on March 29, 2008.
(0)
Guillaum...
Member
34 points
14 Posts
03-25-2008 11:03 AM |
Hello,Here's a simple scenario that fails in silverlight 2.0 beta 1 :
I've got a working solution showing the bug if needed.
Of course, if i copy/paste the content on MyUC to the ItemTemplate there is no problem. No problem also if i declare a DataTemplate as a resource and bind the ItemTemplate to it.
Guillaume
Yi-Lun L...
All-Star
25052 points
2,747 Posts
03-27-2008 5:30 AM |
Hello, this is the desired behavior. It's due to everything inside your parent StackPanel are in the same name scope.
03-27-2008 5:53 AM |
Hello,If this is the desired behavior, could you give me a sample code showing how i can use a UserControl inside an ItemTemplate ?
Thanks,
03-27-2008 6:00 AM |
Oh, sorry, I thought I was replying to another thread...
03-27-2008 6:08 AM |
Hello,I've found a "workaround" (or the way it was designed to be) : I've created a Silverlight Class Library, added my UserControl in it then referenced this library and this UserControl in ItemTemplate.
I still find it strange that I should pass by a external library for this to work...
kornfish
6 points
6 Posts
03-29-2008 6:57 PM |
I have been trying to figure out this same issue for a few days now. You would think using a UserControl within a DataTemplate would be a fairly common scenario. This must be a bug and hopefully will be fixed in Beta 2.