FindName returning null
Posted: 12 May 2014, 22:46
I will post a paste bin of my C# and XAML in their entirety below. (Please disregard style and such as this was supposed to be a quick demo of C# <-> XAML.)
I'm running into an issue assigning a control via the FindName method.
I saw two examples from sfernandez on the unity forums from last year.
http://forum.unity3d.com/threads/192064 ... ASED/page8
I have a pretty simple Grid -> Two Stack panels of Textblocks defined via XAML that I created with Blend for VS 2013.
I am able to get FindName to return the stackpanels and if I iterate over the children of the stack panels I see that they have the correct number of children but each child's GetName method returns an empty string which I assume has something to do with the FindName not finding it. A colleague of mine tried this and was successful.
The only work around I've found is to select the controls via a hard set GetChildren.Get(i) which is obviously not a long term solution.
Is it possible that this is due to the fact I'm using the Unity Trial? Everything else so far seems to work so I'd find it strange this small method would not function due to my trial status. I have fully purchased NoesisGUI on the asset store during the Madness sale and I am aware that I will have to purchase Unity Pro after my trial to continue using NoesisGUI.
Thanks for any and all help!
Attached Code Below
XAML: http://pastebin.com/hY706fEs
C#: http://pastebin.com/KSd98LEp
* Note: The code includes some extra fluff and other things I tried to get it working so the "current state" has diverged from the example provided in the aforementioned link.
Additional question: Should I be using a UserControl for this? When is the ideal time to use a UserControl over the way I've done it here? Example cases?
I'm running into an issue assigning a control via the FindName method.
I saw two examples from sfernandez on the unity forums from last year.
http://forum.unity3d.com/threads/192064 ... ASED/page8
I have a pretty simple Grid -> Two Stack panels of Textblocks defined via XAML that I created with Blend for VS 2013.
I am able to get FindName to return the stackpanels and if I iterate over the children of the stack panels I see that they have the correct number of children but each child's GetName method returns an empty string which I assume has something to do with the FindName not finding it. A colleague of mine tried this and was successful.
The only work around I've found is to select the controls via a hard set GetChildren.Get(i) which is obviously not a long term solution.
Is it possible that this is due to the fact I'm using the Unity Trial? Everything else so far seems to work so I'd find it strange this small method would not function due to my trial status. I have fully purchased NoesisGUI on the asset store during the Madness sale and I am aware that I will have to purchase Unity Pro after my trial to continue using NoesisGUI.
Thanks for any and all help!
Attached Code Below
XAML: http://pastebin.com/hY706fEs
C#: http://pastebin.com/KSd98LEp
* Note: The code includes some extra fluff and other things I tried to get it working so the "current state" has diverged from the example provided in the aforementioned link.
Additional question: Should I be using a UserControl for this? When is the ideal time to use a UserControl over the way I've done it here? Example cases?