- jc_lvngstn
- Posts: 34
- Joined:
Can't find this Expander.
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;
}
- jc_lvngstn
- Posts: 34
- Joined:
Re: Can't find this Expander.
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
- Posts: 34
- Joined:
Re: Can't find this Expander.
Ok, that was the issues...it was retrieving the wrong panel.
Please close this
Please close this
-
sfernandez
Site Admin
- Posts: 3188
- Joined:
Re: Can't find this Expander.
Ok, I'll answer in the other thread
Who is online
Users browsing this forum: tlo and 6 guests