View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002498 | NoesisGUI | Unity | public | 2023-01-31 07:23 | 2023-10-16 20:38 |
| Reporter | jphyzic | Assigned To | sfernandez | ||
| Priority | normal | Severity | minor | ||
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.1.4 | ||||
| Target Version | 3.2.0 | Fixed in Version | 3.2.0 | ||
| Summary | 0002498: Behaviors gets detached when associated object is temporarily removed from visual tree | ||||
| Description | Assume that we have a UI with several controls with attached behaviors and user wishes to rearrange them from code behind. To do that he should temporarily remove controls from their parents and add them to a new place. Problem is that when a control gets removed from visual tree all behaviors attached to it gets detached and are not reattached when the control is added back. See more: https://www.noesisengine.com/forums/viewtopic.php?p=15217 | ||||
| Steps To Reproduce |
TestBehaviour implementation:
}
On app startup the TestBehaviour gets attached. Clicking on a button causes the Border element to be temporarily removed from ItemsControl and added back. It causes the TestBehaviour to be detached. | ||||
| Platform | Any | ||||
| related to | 0002730 | assigned | sfernandez | AssociatedObject is null while detaching Behaviours |
|
I've managed to find a workaround. Not sure if it's reliable, but better than nothing: public static class NoesisBehaviorsFixes
Usage: any manipulation with UI elements that involves detaching them from visual tree should be guarded: using (NoesisBehavioursFixes.GuardDetachingBehaviors()) |
|
|
This is the patch:
|
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2023-01-31 07:23 | jphyzic | New Issue | |
| 2023-02-03 10:24 | jphyzic | Note Added: 0008257 | |
| 2023-02-03 19:24 | sfernandez | Assigned To | => sfernandez |
| 2023-02-03 19:24 | sfernandez | Status | new => assigned |
| 2023-02-03 19:24 | sfernandez | Target Version | => 3.2.0 |
| 2023-02-14 11:09 | sfernandez | Status | assigned => resolved |
| 2023-02-14 11:09 | sfernandez | Resolution | open => fixed |
| 2023-02-14 11:09 | sfernandez | Fixed in Version | => 3.2.0 |
| 2023-02-14 11:09 | sfernandez | Note Added: 0008281 | |
| 2023-10-16 20:38 | jsantos | Relationship added | related to 0002730 |
| 2025-10-10 13:29 | jsantos | Category | Unity3D => Unity |