private Person[] _people = new Person[] { new Person { Name = "PersonA" }, new Person { Name = "PersonB" } };
public Page() { InitializeComponent(); listBox.ItemsSource = _people; }
}
public class Person { public string Name { get; set; } }
Everything appears as it should.
What I want to do is get the textboxes that it generates so that I can find their position on the screen. FindName always seem to return null and I cant just drill down through the content because ItemsControl doesnt inherit from content control. I'm a little
stuck as to the best way to do this so any help would be greatly appreciated.
Trotter
Member
1 Points
2 Posts
Newbie question regarding ItemsControls
Jun 21, 2009 09:41 PM | LINK
Hello all!
Im still new at Silverlight so please bear with me but I am having trouble with my ItemsControl. My XAML looks like this;
Here's the code;Everything appears as it should.
What I want to do is get the textboxes that it generates so that I can find their position on the screen. FindName always seem to return null and I cant just drill down through the content because ItemsControl doesnt inherit from content control. I'm a little stuck as to the best way to do this so any help would be greatly appreciated.
msalsbery
Contributor
4432 Points
773 Posts
Re: Newbie question regarding ItemsControls
Jun 21, 2009 10:03 PM | LINK
You could override the PrepareContainerForItemOverride() method in an ItemsControl-derived class.
That method will be passed an item and the container created for the item.
See here for more details...
MArk
Trotter
Member
1 Points
2 Posts
Re: Re: Newbie question regarding ItemsControls
Jun 21, 2009 11:40 PM | LINK
They make it look so easy! Thanks for the help thats me sorted for now.