AB4D Forum

Full Version: BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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);
           }
       }
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

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