Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simple WPF with a chromium browser guide

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Andrej.Licanin
671 Views, 1 Reply

Simple WPF with a chromium browser guide

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.

Tags (2)
Labels (2)
1 REPLY 1
Message 2 of 2

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community