jc_lvngstn
Topic Author
Posts: 34
Joined: 23 Sep 2013, 03:03

Can't find this Expander.

07 Oct 2013, 01:20

Here is the first part of my xaml:
<DockPanel
   Name="UIStructurePlanner"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" mc:Ignorable="d"
	MaxWidth="196"
	MaxHeight="196">

	<Expander Name="ExpandStructurePlanner" Header="Structure Placement">
And here is the code in my Unity script's Start function:
	private void Start()
	{
		_UIPanel = GetComponent<NoesisGUIPanel>();
		FrameworkElement root = _UIPanel.GetRoot<FrameworkElement>();
		_DockPanel = root.FindName<DockPanel>("UIStructurePlanner");
		Expander expander = _DockPanel.FindName<Expander>("ExpandStructurePlanner");
		expander.Expanded += ExpanderExpanded;
	}
For some reason, the line that subscribes to the Expanded event fails because it isn't finding the Expander. I've tried using FindName from the root also.
 
jc_lvngstn
Topic Author
Posts: 34
Joined: 23 Sep 2013, 03:03

Re: Can't find this Expander.

07 Oct 2013, 01:36

Actually, this may be because I have multiple panels on my GameObject, with the camera. If this is the case, this sort of leads back to my question of...how do you handle multiple panels, with multiple scripts, handled by one camera?
 
jc_lvngstn
Topic Author
Posts: 34
Joined: 23 Sep 2013, 03:03

Re: Can't find this Expander.

07 Oct 2013, 14:29

Ok, that was the issues...it was retrieving the wrong panel.
Please close this :)
 
User avatar
sfernandez
Site Admin
Posts: 3188
Joined: 22 Dec 2011, 19:20

Re: Can't find this Expander.

07 Oct 2013, 23:42

Ok, I'll answer in the other thread ;)

Who is online

Users browsing this forum: tlo and 6 guests