-
October 9th, 2012, 02:57 PM
#1
Access usercontrol which is hosted within databount ItemsControl
Hi folks,
I have created a UserControl (a fairly complex with one various fields and other UI elements) and have databound my view's collection to an ItemsControl. So I have a scrollable set of UserControls arranged nicely on my window, the fields are properly connected to my data, etc., etc. But now...
I need to access one or more of the UserControls directly, rather than through their databinding. All the documentation I can find suggests I do something like the code shown below. (MyUserControl is the class for my UserControl, and ParamControls is the ItemsControl.)
Dim c As MyUserControl
For i As Integer = 0 To ParamControls.Items.Count
sp = CType(ParamControls.ItemContainerGenerator.ContainerFromIndex(i), MyUserControl)
...
Next i
But the call to ItemContainerGenerator.ContainerFromIndex() returns a ContentPresentor rather than an object of MyUserControl. I've been unable to figure out how to use this for anything.
How can I directly access my control?
Thanks,
--George
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|