+1

HelixViewport3d::SphereVisual3D - How to add children via XAML (and a back end binding)?

Anonymous 10 years ago updated by anonymous 4 years ago 3
This discussion was imported from CodePlex

BogusException wrote at 2014-07-18 19:15:

Experts,

I have the back end down. Right now, the XAML is the pain.

Given the following working XAML, how should I implement the backend collection of "Conns" (Connections, or Flights) in the Current Flight Demo code (which this came from)?

Below in the abbreviated XAML, this section toward the bottom is the one in question:
   <ItemsControl ItemsSource="{Binding Conns}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                    <Viewport3D /> <--- ??? or...?
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>
I'm 100% on the backend. I just can't figure out how to make the XAML under Helix3D ready to bind to/show the collection...

Any help at all REALLY appreciated!!!

pat
:)
<Window x:Class="TheEarthWindow"
    x:Name="TheGlobe"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:t="clr-namespace:HelixToolkit.Wpf;assembly=HelixToolkit.Wpf" 
    Title="TheEarthWindow" Height="800" Width="800">
    <Grid>
        <Grid.Resources>
        [...]
        </Grid.Resources>
        <Grid.Triggers>
        [...]
        </Grid.Triggers>
        <t:HelixViewport3D x:Name="view1" 
                           Background="Black" 
                           CameraRotationMode="Turnball"
                           ClipToBounds="False"
                           Grid.Column="0" 
                           IsHeadLightEnabled="True" 
                           IsHitTestVisible="True"
                           IsPanEnabled="False"
                           IsZoomEnabled="True"
                           MouseDown="OnMouseDown" 
                           MouseMove="OnMouseMove" 
                           ShowCameraInfo="False"
                           ShowCameraTarget="False"
                           ShowCoordinateSystem="False"
                           ShowFieldOfView="False"
                           ShowFrameRate="True"
                           ShowTriangleCountInfo="False"
                           ShowViewCube="True"
                           SubTitle="vASA Global Monitor"
                           SubTitleSize="40"
                           Title="vASA"
                           ZoomExtentsWhenLoaded="True" >
            <t:HelixViewport3D.Camera>
                <PerspectiveCamera Position="600,27400,0" 
                                   LookDirection="0,1,0" 
                                   UpDirection="0,0,1" 
                                   NearPlaneDistance="0.01" 
                                   FarPlaneDistance="Infinity" 
                                   FieldOfView="40">
                    <PerspectiveCamera.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,0,1" Angle="0" x:Name="camRotation" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </Transform3DGroup>
                    </PerspectiveCamera.Transform>
                </PerspectiveCamera>
            </t:HelixViewport3D.Camera>
            <t:SunLight />
            <t:SphereVisual3D x:Name="TheEarthSphere" 
                              Material="{StaticResource EarthJPG}"
                              Radius="1" 
                              ThetaDiv="25" 
                              PhiDiv="25" >
<!-- WHAT GOES HERE FOR TUBES? -->
        <ItemsControl ItemsSource="{Binding Conns}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                        <Viewport3D /> <--- ??? or...?
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
<!-- IS THE ABOVE EVEN IN THE RIGHT PART OF THE TREE? -->
            </t:SphereVisual3D>
        </t:HelixViewport3D>
    </Grid>
</Window>