Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8565

Embedding a Rhino.UI.Controls.ViewportControl into a xaml form

$
0
0

@csykes wrote:

I have been trying to embed a Rhino Viewport into my XAML form. I’m thinking the only way to do this will be to create my form with a blank square and add the ViewportControl in during runtime.

I have had a read through and play with SampleCsEtoViewportCommand which was very helpful and tried to add it to my project, this lead me to Eto and as such I have referenced in Eto.dll from the Rhino 7 WIP Folder because the NuGet package seems to have issues.

// SampleCsEtoViewportCommand

`internal class SampleCsViewportForm : Dialog
{
public SampleCsViewportForm()
{
Title = “Rhino Viewport in an Eto Control”;
Resizable = true;
var viewport_control = new
{
new Rhino.UI.Controls.ViewportControl {Size = new Size(400, 200)},
new Rhino.UI.Controls.ViewportControl {Size = new Size(400, 200)}

  };
  Content = new StackLayout
  {
    Padding = new Padding(2),
    Spacing = 5,
    HorizontalContentAlignment = HorizontalAlignment.Stretch,
    Items =
      {
        viewport_control[0],
        viewport_control[1]
      }
  };
}

}

I have a read through the Eto Wiki on GitHub and found no help in the XAML section XAML Tips & Tricks but I did find a section for how to embed Eto.Forms into another application Embed Eto Forms

However I got stuck there on trying to find more on the .ToNative() property that seems to convert an Eto Form to a Windows Form.

System.Windows.Forms.Control myEtoControlAsWinForms = eto.ToNative(true);

I assume I could replace eto with the new StackLayout I created earlier but that doesn’t seem to work.

Thanks

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8565

Trending Articles