mshvern23
Topic Author
Posts: 35
Joined: 22 May 2023, 02:00

UIElement on top of everything else

09 Aug 2023, 03:34

I'm trying to address a common use case of having an element render on top of everything else (think tooltip, tutorial, button prompt, etc.)
What's the best and easiest way to achieve this? I understand there's a z index property, but that doesn't work well with nested hierarchies. Googling has lead me to some Adorner stuff but I'm really lost as to how to proceed with that. Basically, I have all the behavior I need set up and working as expected, the only problem is that tooltip-like objects are sometimes obstructed by other UI elements.

Is there a way to achieve something like this with an attached property? Something like
noesis:RenderAfterEverything="{Binding IsTooltip}"
 
User avatar
sfernandez
Site Admin
Posts: 3109
Joined: 22 Dec 2011, 19:20

Re: UIElement on top of everything else

14 Aug 2023, 16:44

Popups are rendered on top of everything else, this is how default ToolTips are implemented. So placing some UI inside a Popup element will make it show on top of everything else.
<Grid>
  ...
  <Popup IsOpen="{Binding ShowToolTip}">
    <Border>...tooltip contents...</Border>
  </Popup>
</Grid>
Regarding adorners, they are added to the AdornerLayer defined in the root of the Noesis View. An Adorner is usually associated with a target element (the adorner is positioned and sized as the target element) to decorate that target. For example, if you want to show some selection rectangle and info when you click something.
Ptr<MyAdorner> myAdorner = MakePtr<MyAdorner>(targetElement);
AdornerLayer* layer = GetAdornerLayer(targetElement);
layer->Add(myAdorner);
Hope this helps.

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest