|
-
Sep 22nd, 2009, 10:13 AM
#6
Thread Starter
New Member
Re: How to loop through a set of controls on a WPF Window
Thanks for the help everyone, I tried everything you suggested chris. I was able to count the controls. However, i was unable to directly access the object of the control, I could only return the control type. I.E textbox, stackpannel etc. Other values such as Text, tags etc where not accessable and for my desired requirements, need to be.
I will try what you suggested saber; i tried a simular method without success, but yours is a bit different so may hopefully work.
To go into a bit more detail about the scenario....
my program creates controls based on data from an sql database. The way it does this is create a stackpannel, inside this stack pannel is a "title" textbox field and a "content" textbox field. There may be many of these stackpannels ( 10+) . Each stackpannel and control inside it will also contain the ID from the database in its .tag, this is the identifyer used for the resubmission of data to the database.
So in essence create a loop such as this.
Code:
For each control in the content window
If the control is a stackpanel then
For each textbox in that stackpanel
connect to sql based on the textbox.tag and update the record with the textbox.text data
next
end if
next
I will post back with any further developments , cheers everyone.
---------
EDIT
---------
I have For each loop version working, thanks for all the help , i will post it up later, so anyone else having this problem can see the solution.
Last edited by CJay; Sep 22nd, 2009 at 10:34 AM.
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
|