Binding triggered before control is loaded #15276
-
The goal is to display the underline of the tab element with a transition animation: SightKeeper.Avalonia_nsgLCwD8VH.mp4so I used canvas and MultiBinding to TabStrip via RelativeSource to position the underline but the problem is that the binding is triggered before the elements are loaded, and the converter cannot receive the container of the selected item, because there is no panel yet: as a result, the initially selected item (indicated in pale red) does not have a line under it until another item is selected: SightKeeper.Avalonia_cwqQPGHZHA.mp4is there a way to trigger binding without special crutches when the parent control (TabStrip) is fully loaded, or maybe I'm missing an easier way to do it in general? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The easiest way I can think of to work around this is to create the animation in code behind when the However, without seeing more of what you done it's hard to say if there is a better way. |
Beta Was this translation helpful? Give feedback.
-
Fixed it with a not-so-ugly crutch
IsLoaded property binded in MultiBinding, so it is triggered when control is loaded (Control.Loaded event is very useful). |
Beta Was this translation helpful? Give feedback.
The easiest way I can think of to work around this is to create the animation in code behind when the
Loaded
/AttachedToVisualTree
events fire.However, without seeing more of what you done it's hard to say if there is a better way.