"Read-only" display on embedded ViewPortControl in WPF app

Hi guys,

I am embedding a Rhino ViewPortControl in a WPF app and I am trying to change the display modes of it but it only displays in Wireframe mode.

I have this event handler which assigns the display mode selected in the UI to the _activeViewPort (RhinoViewport)

 private void RhinoDisplayModesCache_DisplayModeSelected(object sender, RhinoDisplayMode selectedDisplayMode)
      var rhinoDisplayMode = DisplayModeDescription.GetDisplayMode(selectedDisplayMode.Id);

        _activeViewPort.DisplayMode = rhinoDisplayMode;

RhinoDisplayMode is my own class, this does not really matter but Its worth clarifying to avoid any confusion.

In addition, RhinoViewport.ZoomExtents() seems to have no effect as well.

Is it possible to update a ViewportControl like I am trying to do?

@dale, @stevebaer do you guys have some info on this? or on any workarounds?

PS: This app runs within Revit

Thank you!


Here’s a sample that allows setting different display modes


@stevebaer thank you for your quick reply and apologies for my late reply!
Thanks for the sample - it proved quite useful even though I am not running rhino within a standalone wpf app. I cloned the repo, build and ran the above sample to see if it has the same issue as my version and it does. Whenever I am scrolling to zoom, the XYZ axis is being transformed while zooming out:

Of curse, this does not happen when opening rhino itself.

I looked at the camara properties on a normal rhino file and when zooming, all of the following values change:


When I subscribed to the MouseWheel event and set a debug breakpoint to check the same values, they dont change, their values are always constant. So I guess that is where the problem lies.

 private void ViewportControl_MouseWheel(object sender, MouseEventArgs e)
        var camaraLocation = _viewportControl.Viewport.CameraLocation;
        var camaraTarget = _viewportControl.Viewport.CameraTarget;
        var camaraX = _viewportControl.Viewport.CameraX;
        var camaraY = _viewportControl.Viewport.CameraY;
        var camaraZ = _viewportControl.Viewport.CameraZ;

How can I guarantee the same behavior like in rhino? Is there something else that has to be done?

Thanks again,


@stevebaer the main issue we’re having has been lost in the thread. Just to restate the main issue:
We have scrolling and zooming issues which appear to be related to viewport scaling - could it be caused by the fact we’re running this app in Revit as a add-in and use RiR to convert Revit elements into BReps and there is some mismatch between the how the two applications handle geometry in its unit environment? We really need to find a solution to this problem.

In summary:

  1. The camera focal distance is extreme which results in peculiar effects when rotating the model - like an extreme fisheye.
  2. When the grid is displayed in the embedded viewport it appears much smaller relative to the geometry compared to outputting the same geometry directly into Rhino (1000x smaller by estimate).
  3. The XYZ axis animation (bottom left of viewport) has odd length axes in the embedded viewport but they are all equal when viewing the animation in the Rhino application.
  4. Zoom extends all does not resolve the issue.

Have you seen this problem before?