Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Simple WPF with a chromium browser guide

Andrej.Licanin
Advocate

Simple WPF with a chromium browser guide

Andrej.Licanin
Advocate
Advocate

This is for the all lost souls out there, may you avoid my suffering.

 

To create a chromium web browser in your revit addin, you need to reference cefsharp dlls. THis is where i have a major hiccup because I just installed the newest one by nuget. Dont do this. Revit already has them and it initializes them on start up.

Yuu just need to add them like the API .dlls . They are in the CefSharp folder.

 

For me it was

C:\Program Files\Autodesk\Revit 2022\CefSharp

the files are 

CefSharp.Core

CefSharp.Wpf

CefSharp.BrowserSubprocess.Core

CefSharp

 

once installed you can just add a wpf window, reference the namespace and embed a chromium browser. 
Like this:


<Window x:Class="RevitTestProject.TestWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:RevitTestProject"
        xmlns:cef="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
        mc:Ignorable="d"
        Width="1000" Height="500">
    <Grid Background="PapayaWhip">

        <cef:ChromiumWebBrowser Name="ChromiumBrowser" Address="http://www.google.com" Width="900" Height="450"  />
    </Grid>
</Window>

 
Hope this helps some one as i lost an entire day figuring this out.

Reply
Accepted solutions (1)
1,054 Views
1 Reply
Reply (1)

jeremy_tammik
Autodesk
Autodesk
Accepted solution

Thank you very much for sharing this simple solution. I added it to the blog for greater visibility:

  

https://thebuildingcoder.typepad.com/blog/2023/11/camera-target-and-toposolid-subdivision-material.h...

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open