Page 1 of 1

Can't find this Expander.

Posted: 07 Oct 2013, 01:20
by jc_lvngstn
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.

Re: Can't find this Expander.

Posted: 07 Oct 2013, 01:36
by jc_lvngstn
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?

Re: Can't find this Expander.

Posted: 07 Oct 2013, 14:29
by jc_lvngstn
Ok, that was the issues...it was retrieving the wrong panel.
Please close this :)

Re: Can't find this Expander.

Posted: 07 Oct 2013, 23:42
by sfernandez
Ok, I'll answer in the other thread ;)