HelixViewport3D is missing when using Prism to load the user control to a region

Anonymous 10 years ago 0
This discussion was imported from CodePlex

sowen wrote at 2014-02-04 19:48:


don't know if anyone has experienced this:

I try to put HelixViewport3D in a user control like this
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <h:HelixViewport3D ZoomExtentsWhenLoaded="True"
            Width="{Binding ActualWidth, ElementName=Container, Mode=OneWay}" 
            Height="{Binding Height, ElementName=Container, Mode=OneWay}">
            <h:SunLight />
and in my Shell.xaml, I have this
<ContentControl cal:RegionManager.RegionName="MainCanvasRegion" Width="auto" Height="auto" />
Next, I use Prism to load the UserControl to the region like this
                                                  () => _container.Resolve<HelixCanvasView>());
the user control is placed to the ContentControl, but the user control has nothing in it.

I use Snoop to check. In the visual tree, the HelixCanvasView is in the tree, but underneather, it has nothing. Everything is gone. Very strange.

The way I am using Prism is correct. The shell has other regions, and other user controls are loaded properly. It's only this user control with HelixViewport3D. Well, technically, the control is loaded, but the HelixViewport3D is kicked out.

Does anyone know why?


sowen wrote at 2014-02-05 15:57:

ok, I found out the problem of this issue. It's not really related to Helix control.

It feels more like a Microsoft bug.

For testing purpose, I was using a static resource of array for the items source, but as long as it's there, it kicks out the InitializeComponent method. So my user control becomes blank.

It's very strange, because the same way of defining the static resource works fine in Windows-level. The problem is only in the User Control level. and I can't find any reason or solution to it.