Reputation: 33
I have dynamically created a series of grids
and textblocks
inside of said grids. However I am having trouble using the .FindName to call the textblock
I need. My control heirarchy goes something like this:
Page -> ScrollViewer - > Grid -> Dynamically Created Grids -> Dynamically Created Controls
This is how I am currently trying to call them and any other ways I attempted have still gotten me no where
Dim grd As Object = FindName("GridLine" + Ri.ToString())
Dim tempgrd As Grid = DirectCast(grd, Grid)
Dim txtID As Object = tempgrd.FindName("txtIDGrid" + Ri.ToString())
Dim tempID As TextBlock = DirectCast(txtID, TextBlock)
sqlID = tempID.Name
Upvotes: 0
Views: 90
Reputation: 33
In case anyone else is searching for a similar answer I did end up solving it. You must be sure to RegisterName
the controls you are creating to ensure that you can call upon it after runtime.
Upvotes: 1