BoxUIElement3D.ToolTip is not displayed if this is a child of a ModelVisual3D
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.

        <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.
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:

       public object ToolTip
               return System.Windows.Controls.ToolTipService.GetToolTip(this);
               System.Windows.Controls.ToolTipService.SetToolTip(this, value);
Andrej Benedik
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.


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

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

By the way:

You made a great framework!


Forum Jump:

Users browsing this thread:
1 Guest(s)