AB4D Forum
BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D (/showthread.php?tid=4175)



BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D - close - 02-29-2020

Hi there,
I have the problem that the ToolTip of the BoxUIElement3D is not displayed if the BoxUIElement3D was generated in the C# code.
If the BoxUIElement3D is created in the XAML code, it works.


XAML:
        <Border Name = "ViewportBorder" Background = "Transparent" Cursor = "Arrow">
            <Viewport3D Name = "MainViewport" Cursor = "Arrow">
                <ModelVisual3D x: Name = "MainRootTransform">

                    <! - OK ->
                    <uiElements: BoxUIElement3D CenterPosition = "0 0 0" Size = "1000 1000 1000"
                                            Material = "{StaticResource ObjectsMaterial}"
                                            ToolTip = "This is a simple tooltip"/>
                </ ModelVisual3D>
            </ Viewport3D>
        </ Border>


C #:
            Ab3d.UIElements.BoxUIElement3D boxUIElement3D1 = new Ab3d.UIElements.BoxUIElement3D ();
            boxUIElement3D1.ToolTip = "This is a ToolTip ...";
            boxUIElement3D1.CenterPosition = new Point3D (0, 0, 0);
            boxUIElement3D1.Size = new Size3D (5000, 5000, 5000);
            boxUIElement3D1.Material = boxMaterial;
           
            MainViewport.Children.Add (boxUIElement3D1); // OK -> ToolTip is shown
            //MainRootTransform.Children.Add (boxUIElement3D1); // NOK -> ToolTip is NOT shown



With thanks in advance.
close


RE: BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D - abenedik - 03-01-2020

I tried to reproduce your problem but tootip was shown for me in both cases. I also added some transformation to the MainRootTransform object and did some other changes and the tooltip was shown in all the cases.

Is there some other change in the code that is different when the tooltip is not shown? 

Btw: showing tooltip is done completely by the WPF code and not by any code in Ab3d.PowerToys - the Tooltip getter and setter are the following:

Code:
       public object ToolTip
       {
           get
           {
               return System.Windows.Controls.ToolTipService.GetToolTip(this);
           }
           set
           {
               System.Windows.Controls.ToolTipService.SetToolTip(this, value);
           }
       }



RE: BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D - close - 03-09-2020

Hi Abenedik,

thanks for the reply!

I found out that the events are not thrown when i add the rootTransform MainViewport before i add the UIElement3D objects to the rootTransform.


Exp.:

This works:       
Code:
           ModelVisual3D rootTransformModelVisual3D = new ModelVisual3D();
           Ab3d.UIElements.BoxUIElement3D box = new BoxUIElement3D();
           box.ToolTip = "am i visible?";
           rootTransformModelVisual3D.Children.Add(box);
->          MainViewport.Children.Add(rootTransformModelVisual3D);


This doesn't work:       
Code:
           ModelVisual3D rootTransformModelVisual3D = new ModelVisual3D();
->          MainViewport.Children.Add(rootTransformModelVisual3D);
           Ab3d.UIElements.BoxUIElement3D box = new BoxUIElement3D();
           box.ToolTip = "am i visible?";
           rootTransformModelVisual3D.Children.Add(box);


By the way:

You made a great framework!
Thanks

░░░░░░░░░░░░▄▄░░░░░░░░░
░░░░░░░░░░░█░░█░░░░░░░░
░░░░░░░░░░░█░░█░░░░░░░░
░░░░░░░░░░█░░░█░░░░░░░░
░░░░░░░░░█░░░░█░░░░░░░░
███████▄▄█░░░░░██████▄░░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
▓▓▓▓▓▓█░░░░░░░░░░░░░░█░
▓▓▓▓▓▓█████░░░░░░░░░█░░
██████▀░░░░▀▀██████▀░░░░