Host Silverlight in the Windows.Forms without the WebBrowser control

前端 未结 2 1486
陌清茗
陌清茗 2021-01-05 05:15

Is it possible to host Silverlight in the Windows.Forms without the WebBrowser control to avoid unnecessary COM marshaling?

EDIT: The goal is to use

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-05 05:30

    Although it may be possible to hack a solution together that doesn't use IE as a host for Silverlight content, it would not be supported by Microsoft (and thus you may run into design and stability issues). Your best bet would be to use the browser as a direct host and try to minimize the number of instances you're using (to limit the amount of memory used by hosting Internet Explorer instances).

    You mentioned WPF -- the necessary platform pieces are not available on Windows 2000 to support WPF.

    After a short (and failed) experiement to host Silverlight content directly on a WinForm, it's clear that it was't designed for this scenario. You can try adding the control to WinForm (just add it as a COM reference in the controls, it's called "Microsoft Silverlight"). It sites correctly as a control, but setting the source URL isn't sufficient, and there aren't obvious methods to make it "go". It doesn't download, nor paint correctly.

提交回复
热议问题