Can't find this Expander.
Posted: 07 Oct 2013, 01:20
Here is the first part of my xaml:
And here is the code in my Unity script's Start function:
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.
Code: Select all
<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">Code: Select all
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;
}