<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: WPF Window inside an Inventor Add-In in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9613791#M111439</link>
    <description>&lt;P&gt;I'm glad I could help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jul 2020 05:56:52 GMT</pubDate>
    <dc:creator>dba78</dc:creator>
    <dc:date>2020-07-02T05:56:52Z</dc:date>
    <item>
      <title>WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/6222854#M111429</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This post relates to &lt;A href="http://adndevblog.typepad.com/manufacturing/2015/11/wpf-window-inside-an-inventor-add-in.html#tpe-action-posted-6a0167607c2431970b01b8d1b0850b970c" target="_self"&gt;this&lt;/A&gt; post by&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy﻿&lt;/a&gt;&amp;nbsp;so hopefully he will see and reply directly but:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create a wpf window inside of an Inventor Addin- I know I can do this with a windows form, but I found Adam's post and thought I would give it a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inside of the Addin I added a User Control and placed the following code inside:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;Window x:Class="Power_Pack_For_Inventor_AddIn.SelectFeaturesWindow"
             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:Power_Pack_For_Inventor_AddIn"
             mc:Ignorable="d" ResizeMode="CanResize" Height="354.667" Width="457.333" BorderThickness="2" SizeToContent="WidthAndHeight" Padding="0"&amp;gt;
    &amp;lt;StackPanel Background="Gray" Margin="0,0,0,0"&amp;gt;
        &amp;lt;Button x:Name="button" Content="Button" VerticalAlignment="Bottom" Margin="0,0,0,0"/&amp;gt;
        &amp;lt;Border BorderBrush="OldLace" BorderThickness="10" CornerRadius="10"
            HorizontalAlignment="Center" VerticalAlignment="Center"&amp;gt;
            &amp;lt;Image Source="ksp.jpg" Width="200" Height="200"
             Stretch="Fill" x:Name="blogImage" /&amp;gt;
            &amp;lt;Border.RenderTransform&amp;gt;
                &amp;lt;SkewTransform CenterX="250" CenterY="0"
                       AngleX="0" AngleY="350" /&amp;gt;
            &amp;lt;/Border.RenderTransform&amp;gt;
        &amp;lt;/Border&amp;gt;
        &amp;lt;Border Width="220" Height="300" BorderThickness="10"
            CornerRadius="10" BorderBrush="OldLace"&amp;gt;
            &amp;lt;Border.Background&amp;gt;
                &amp;lt;VisualBrush Visual="{Binding ElementName=blogImage}"&amp;gt;
                    &amp;lt;VisualBrush.Transform&amp;gt;
                        &amp;lt;ScaleTransform ScaleX="1" ScaleY="-1"
                            CenterX="200" CenterY="150" /&amp;gt;
                    &amp;lt;/VisualBrush.Transform&amp;gt;
                &amp;lt;/VisualBrush&amp;gt;
            &amp;lt;/Border.Background&amp;gt;
            &amp;lt;Border.OpacityMask&amp;gt;
                &amp;lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&amp;gt;
                    &amp;lt;GradientStop Offset="0" Color="Black" /&amp;gt;
                    &amp;lt;GradientStop Offset="0.3" Color="Transparent" /&amp;gt;
                &amp;lt;/LinearGradientBrush&amp;gt;
            &amp;lt;/Border.OpacityMask&amp;gt;
            &amp;lt;Border.RenderTransform&amp;gt;
                &amp;lt;SkewTransform CenterX="260" CenterY="0"
                       AngleX="40" AngleY="350" /&amp;gt;
            &amp;lt;/Border.RenderTransform&amp;gt;
        &amp;lt;/Border&amp;gt;
    &amp;lt;/StackPanel&amp;gt;
&amp;lt;/Window&amp;gt;&lt;/PRE&gt;&lt;P&gt;Inserted into the SelectFeaturesWindow.xaml.vb element of that Window.xaml file I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Namespace Power_Pack_For_Inventor_AddIn
    Partial Public Class SelectFeaturesWindow
        Inherits Window
        Public Sub New()
            'InitializeComponent()
        End Sub

        Private Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click
            MessageBox.Show("Hello World!", "Feature type selection.")
            Me.Close()
        End Sub
    End Class
End Namespace&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inside of my Inventor Addin I have a button which when clicked runs this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Try
	Dim oDoc As Document = g_inventorApplication.ActiveDocument
	'Show the WPF Form!
	Dim selectFeaturesFrm As New SelectFeaturesWindow
	Dim helper As New WindowInteropHelper(selectFeaturesFrm)
	helper.Owner = New IntPtr(g_inventorApplication.MainFrameHWND)
	selectFeaturesFrm.ShowDialog()
Catch ex As Exception

End Try&lt;/PRE&gt;&lt;P&gt;and all looks fine. The code builds, the addin loads and I can click the button in my ribbonbar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that when the Window loads it looks like this inside of Inventor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/225626i80E1DAFD40064AEA/image-size/large?v=mpbl-1&amp;amp;px=-1" border="0" alt="XAML Broken.PNG" title="XAML Broken.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A big ol' screen of white nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I look in the designer inside of Visual Studio I can clearly see it working though:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/225631i5C2B273A19AA79B0/image-size/large?v=mpbl-1&amp;amp;px=-1" border="0" alt="XAML Working.PNG" title="XAML Working.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT: As I typed this out, I changed one thing and it started working:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I changed the uncommented the InitializeComponent() having previously modified the class inside of the XAML from this:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;Window x:Class="SelectFeaturesWindow"&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;To this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;Window x:Class="Power_Pack_For_Inventor_AddIn.SelectFeaturesWindow"&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;And lo and behold it started working.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I could have not bothered with this post at all now that it is working but I figured it may help others like myself who are just starting&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;to delve into WPF with Inventor to pay attention to these small details.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 13:24:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/6222854#M111429</guid>
      <dc:creator>AlexFielder</dc:creator>
      <dc:date>2016-03-18T13:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/6222925#M111430</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Glad you managed to figure it out and thanks for sharing it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since questions&amp;nbsp;cannot be marked as solutions I'll mark my answer as such - so that others know it's solved.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 13:53:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/6222925#M111430</guid>
      <dc:creator>adam.nagy</dc:creator>
      <dc:date>2016-03-18T13:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9209202#M111431</link>
      <description>&lt;P&gt;Hi, just to clarify what happened:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in a Visual Basic-Project you don't need to add Namespace to each class you create. the compiler will add the Default Namespace of you project.&lt;/P&gt;&lt;P&gt;So you had your Default-Namespace&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Power_Pack_For_Inventor_AddIn&lt;/PRE&gt;&lt;P&gt;in you project and you additionally added it to your xam.vb&lt;/P&gt;&lt;P&gt;so after compile your partial class' (xaml.vb) qualified name became&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Power_Pack_For_Inventor_AddIn.Power_Pack_For_Inventor_AddIn.SelectFeaturesWindow&lt;/PRE&gt;&lt;P&gt;your Xaml was compiled to&lt;/P&gt;&lt;PRE&gt;Power_Pack_For_Inventor_AddIn.SelectFeaturesWindow&lt;/PRE&gt;&lt;P&gt;They "didn't find each other" on runtime....&lt;/P&gt;&lt;P&gt;So yes, adding this extra Namespace to your xaml-Class Name solved the problem apparently,&amp;nbsp;&lt;/P&gt;&lt;P&gt;but you capsulated both in a subnamespace (xaml and xaml.vb)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The correct solution in this case is to remove the extra Namespace in xaml.vb&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And finally: this is not related to Inventor, but to VB (In C# you are forced to fully qualify all your classes, so this wouldn't have popped up)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In WPF do not comment out the InitializeComponent() Method!!! In VB you're not forced to have the default ctor, but if you have it, the InitializeComponent calls the building of the UIElement and therefore must not be commented out!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 11:47:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9209202#M111431</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2019-12-18T11:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9604076#M111432</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/339467"&gt;@adam.nagy&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the same approach you mentioned in your&amp;nbsp;article your&amp;nbsp;&lt;A href="https://adndevblog.typepad.com/manufacturing/2015/11/wpf-window-inside-an-inventor-add-in.html" target="_blank"&gt;https://adndevblog.typepad.com/manufacturing/2015/11/wpf-window-inside-an-inventor-add-in.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;but Addin(c#) doesn't show the images(.png and .jpg) dockable windows. I found some information about build event changing to resource in properties of images(&lt;A href="https://stackoverflow.com/questions/15653105/in-my-wpf-application-my-loaded-png-logo-in-image-shows-at-design-time-but-not" target="_blank"&gt;https://stackoverflow.com/questions/15653105/in-my-wpf-application-my-loaded-png-logo-in-image-shows-at-design-time-but-not&lt;/A&gt;).Could you pls help me with this?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 16:23:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9604076#M111432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-26T16:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9606936#M111433</link>
      <description>&lt;P&gt;you may try the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;add your image files as project resources (project-&amp;gt; properties-&amp;gt;resources-&amp;gt;images)&lt;/LI&gt;&lt;LI&gt;make sure the files will compiled as resources (select file in project explorer, 'F4' -&amp;gt;Build Action=Resource)&lt;/LI&gt;&lt;LI&gt;set 'Copy Local'=false&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This way WPF finds the resource on runtime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 06:22:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9606936#M111433</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2020-06-29T06:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607170#M111434</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I have already tried these steps you mentioned.It is now working.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 08:58:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607170#M111434</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-29T08:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607188#M111435</link>
      <description>&lt;P&gt;could you please paste your call to the resource in XAML?&lt;/P&gt;&lt;P&gt;&amp;lt;Image Source="..."/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 09:02:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607188#M111435</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2020-06-29T09:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607374#M111436</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xaml.PNG" style="width: 897px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/789542iC49AA68936EA4F01/image-size/large?v=v2&amp;amp;px=999" role="button" title="xaml.PNG" alt="xaml.PNG" /&gt;&lt;/span&gt;still can't see images. I debugging addin and compile. But the result is the same.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 10:07:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607374#M111436</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-29T10:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607385#M111437</link>
      <description>&lt;P&gt;hi, as assumed, you have a malformed Uri in your Source-Attribute.&lt;/P&gt;&lt;P&gt;this should help you out:&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/5552618/how-to-reference-image-resources-in-xaml" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/5552618/how-to-reference-image-resources-in-xaml&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/9419611/how-to-refer-to-embedded-resources-from-xaml" target="_blank"&gt;https://stackoverflow.com/questions/9419611/how-to-refer-to-embedded-resources-from-xaml&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;(btw: your issue is more WPF than Inventor, so it were better placed on &lt;A href="http://Stackoverflow.com" target="_blank" rel="noopener"&gt;SO&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 10:16:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9607385#M111437</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2020-06-29T10:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9608510#M111438</link>
      <description>&lt;P&gt;thx daniel first link handles the issue.&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 19:16:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9608510#M111438</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-29T19:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9613791#M111439</link>
      <description>&lt;P&gt;I'm glad I could help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 05:56:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/9613791#M111439</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2020-07-02T05:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10994276#M111440</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/88414"&gt;@AlexFielder&lt;/a&gt; ,&amp;nbsp;I tried referring your code for my c# addin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;SCDockWindow sc = new SCDockWindow();&lt;/P&gt;&lt;P&gt;Inventor.UserInterfaceManager oUserInterfaceMgr = m_inventorApplication.UserInterfaceManager;&lt;BR /&gt;&lt;U&gt;WindowInteropHelper helper = new WindowInteropHelper(sc);&lt;/U&gt;&lt;BR /&gt;Inventor.DockableWindow oDockWindow = oUserInterfaceMgr.DockableWindows.Add(Guid.NewGuid().ToString(), "iSOlarconfig", "iSolarCOngilas");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SCDockWindow is a wpf page&lt;BR /&gt;&lt;BR /&gt;In the underlined it shows an error indicating that we cannot convert SolarConfigurator.SCDockWindow to System.windows.window&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Can I get a solution for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 16:39:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10994276#M111440</guid>
      <dc:creator>2019mmp003</dc:creator>
      <dc:date>2022-03-09T16:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10994579#M111441</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have myself several WPF windows in my addin. If it doesn't matter to you that you have the ability to dock the window, here how:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the button class:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;on the click event, Create a new thread and create your window instance in it (you want your own UI thread)&lt;/LI&gt;&lt;LI&gt;Store the ContextDispatcher of the UI thread on a private variable (you need this to send/post to the UI thread from the Inventor Thread)&lt;/LI&gt;&lt;LI&gt;From the UI thread, subsbribe to events (best way I found to send data from UI thread to Inventor Thread. Just defined some custom eventArgs class to passs whatever you want)&lt;/LI&gt;&lt;LI&gt;Outside the new thread declaration, store the CurrentDispatcher (Inventor's). you will use it to Invoke/BeginInvoke methods to the Inventor Thread&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can set the window to be top of Inventor so you have something similar to a dockable window by making the Inventor application the owner of the window :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var helper = new WindowInteropHelper(WPFWindow);
                        helper.Owner = new IntPtr(AddInServer.InvApp.MainFrameHWND);&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 09 Mar 2022 18:56:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10994579#M111441</guid>
      <dc:creator>yan.gauthier</dc:creator>
      <dc:date>2022-03-09T18:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10995515#M111442</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5376083"&gt;@yan.gauthier&lt;/a&gt;&amp;nbsp;Can you please provide me some reference code for this! It would be of great help! Thanks!!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 06:20:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10995515#M111442</guid>
      <dc:creator>2019mmp003</dc:creator>
      <dc:date>2022-03-10T06:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10995786#M111443</link>
      <description>&lt;P&gt;Also, when until the wpf window is open, we cannot use any other inventor buttons, how can we use both the window buttons as well as inventor options simultaneously?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 08:56:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10995786#M111443</guid>
      <dc:creator>2019mmp003</dc:creator>
      <dc:date>2022-03-10T08:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10996171#M111444</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;in dockableWindow you will need a &lt;SPAN&gt;ElementHost&amp;nbsp;&lt;/SPAN&gt;(generally spoken, to show WPF Content in Forms-Container).&lt;BR /&gt;See:&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/manufacturing/2012/06/embedding-a-wpf-user-control-in-a-dockablewindow-in-inventor.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/manufacturing/2012/06/embedding-a-wpf-user-control-in-a-dockablewindow-in-inventor.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2022 12:08:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10996171#M111444</guid>
      <dc:creator>dba78</dc:creator>
      <dc:date>2022-03-10T12:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: WPF Window inside an Inventor Add-In</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10996298#M111445</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LoadPropForm here is my WPF window object. It follows the MVVM structure. the ViewModel contains the event to be subscribed to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;override protected void ButtonDefinition_OnExecute(NameValueMap context)
        {

            mainThreadDispatcher = Dispatcher.CurrentDispatcher;

            // Create a thread
            if (!loadPropOpen)
            {
                //Must have an activeEditDocument to run
                if (AddInServer.InvApp.ActiveEditDocument is Document document)
                {
                    Thread newWindowThread = new Thread(new ThreadStart(() =&amp;gt;
                    {
                        // Create our context, and install it:
                        syncContext = new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher);
                        SynchronizationContext.SetSynchronizationContext(syncContext);

                        LoadPropForm = new LoadPropForm(AddInServer.InvApp, mainThreadDispatcher.Invoke&amp;lt;PropModel&amp;gt;(() =&amp;gt;
                        {
                            //Instanciating this instance loads Divalto List async
                            DivaltoLazies divaltoUtilities = DivaltoLazies.Instance;

                            //get material and treatment lists
                            using (var genikAddinDbContext = new Db.GenikAddinDbContext(Constants.GenikAddinDataBaseConnectionString))
                            {
                                //includes treatments as well
                                materials = new ConcurrentBag&amp;lt;Db.Material&amp;gt;(genikAddinDbContext.Materials.Include(x =&amp;gt; x.Treatments).ToList());
                            }

                            return new PropModel(document, materials.ToList());  //Create new propModel from inventor Thread

                        }));
                        // When the window closes, shut down the dispatcher
                        LoadPropForm.Closed += (s, e) =&amp;gt;
                        {
                            mainThreadDispatcher.Invoke(() =&amp;gt;
                            {
                                AddInServer.InvApp.ApplicationEvents.OnActivateDocument -= ApplicationEvents_OnActivateDocument;
                            });

                            Dispatcher.CurrentDispatcher.BeginInvokeShutdown(DispatcherPriority.Background);
                            loadPropOpen = false;

                        };

                        //When Window is loaded reset mouse cursor
                        LoadPropForm.Loaded += (s, e) =&amp;gt;
                        {
                            mainThreadDispatcher.Invoke(() =&amp;gt;
                            {
                                Mouse.OverrideCursor = null;
                            });
                        };
                        ((ViewModel)LoadPropForm.DataContext).InventorUpdated += LoadPropButton_InventorUpdated;
 
                        //Run updating task from main thread
                        ((ViewModel)LoadPropForm.DataContext).SchematikPersistantUpdated += (s, e) =&amp;gt;
                        {
                            mainThreadDispatcher.Invoke(() =&amp;gt;
                            {
                                Document doc;
                                if (AddInServer.InvApp.ActiveEditDocument.FullDocumentName.Equals(e.DocumentName, StringComparison.CurrentCultureIgnoreCase))
                                {

                                    doc = AddInServer.InvApp.ActiveEditDocument;
                                }
                                else
                                {
                                    doc = (from Document woo in AddInServer.InvApp.Documents
                                           where woo.FullDocumentName.Equals(e.DocumentName, StringComparison.CurrentCultureIgnoreCase)
                                           select woo).FirstOrDefault();
                                }

                                if (doc != null)
                                {
                                    InventorMethods.UpdateCustomProperty(e.ChangedValue, doc, e.PropertyName);
                                }
                                else
                                {
                                    throw new Exception($"la composante {System.IO.Path.GetFileName(e.DocumentName)} n'est pas ouverte.");
                                }


                                //DataControl.InventorExtension.UpdateCustomProperty(e.ChangedValue, AddInServer.InvApp.ActiveEditDocument, e.PropertyName);
                            });
                        };

                        //Print single document from main Inventor Thread
                        ((ViewModel)LoadPropForm.DataContext).PrintDrawingEvent += (s, e) =&amp;gt;
                        {
                            mainThreadDispatcher.Invoke(() =&amp;gt;
                            {
                                if (InventorMethods.CompareWithVault(e.Model.FilePath))
                                {
                                    InventorMethods.PrintSingleDrawing(e.Model, e.Settings, e.Quantity);
                                }
                            });
                        };


                        //Setting up Owner makes the windows over its owner only
                        var helper = new WindowInteropHelper(LoadPropForm);
                        helper.Owner = new IntPtr(AddInServer.InvApp.MainFrameHWND);
                        
                        
                        
                        LoadPropForm.Show();
                        //LoadPropForm.Topmost = true; //always first 
                        loadPropOpen = true;
                        // Start the Dispatcher Processing
                        System.Windows.Threading.Dispatcher.Run();

                    }));

                    // Setup and start thread as before
                    newWindowThread.SetApartmentState(ApartmentState.STA);
                    newWindowThread.IsBackground = true;
                    //Display wait cursor
                    mainThreadDispatcher.Invoke(() =&amp;gt;
                    {
                        Mouse.OverrideCursor = Cursors.Wait;
                    });
                    newWindowThread.Start();

                    AddInServer.InvApp.ApplicationEvents.OnActivateDocument += ApplicationEvents_OnActivateDocument;
                }
            }

        }

        private void LoadPropButton_InventorUpdated(object sender, InventorPropertyEventArgs e)
        {
            mainThreadDispatcher.Invoke(() =&amp;gt;
            {
                Document doc;
                if (AddInServer.InvApp.ActiveEditDocument.FullDocumentName.Equals(e.DocumentName, StringComparison.CurrentCultureIgnoreCase))
                {

                    doc = AddInServer.InvApp.ActiveEditDocument;
                }
                else
                {
                    doc = (from Document woo in AddInServer.InvApp.Documents
                           where woo.FullDocumentName.Equals(e.DocumentName, StringComparison.CurrentCultureIgnoreCase)
                           select woo).FirstOrDefault();
                }

                if (doc != null)
                {
                    InventorMethods.UpdateCustomProperty(e.ChangedValue, doc, e.PropertyName);
                }
                else
                {
                    //fire once ?
                    MessageBox.Show($"la composante: {System.IO.Path.GetFileName(e.DocumentName)}{System.Environment.NewLine}n'est pas ouverte. Les changements sont perdus.", "PropModel", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
                }

            });
        }


        //Update LoadProp info when active document change
        private void ApplicationEvents_OnActivateDocument(_Document DocumentObject, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
        {
            HandlingCode = HandlingCodeEnum.kEventNotHandled; // Let inventor do his things

            if (BeforeOrAfter == EventTimingEnum.kAfter)
            {

                if (materials == null)
                {
                    using (var genikAddinDbContext = new Db.GenikAddinDbContext(Constants.GenikAddinDataBaseConnectionString))
                    {
                        materials = new ConcurrentBag&amp;lt;Db.Material&amp;gt;(genikAddinDbContext.Materials.Include(x =&amp;gt; x.Treatments).ToList());
                    }
                }

                //Generate PropModel on Inventor thread, then send it to UI
                //PropModel propModel = new PropModel(DocumentObject, materialDataSource.ToList(), traitementMateriel.ToList());
                PropModel propModel = new PropModel(DocumentObject, materials.ToList());


                syncContext.Post(o =&amp;gt;
                {
                    ((ViewModel)LoadPropForm.DataContext).InventorUpdated -= LoadPropButton_InventorUpdated;
                    LoadPropForm.ReloadViewModel(DocumentObject, propModel);
                }, null);

                
                syncContext.Post(o =&amp;gt; ((ViewModel)LoadPropForm.DataContext).InventorUpdated += LoadPropButton_InventorUpdated , null);

            }
            else if (BeforeOrAfter == EventTimingEnum.kBefore)
            {
                //Validate if there are pending changes
                //If yes, check if the document is still opened
                bool needToSaveDocumentChanges = false;
                string fileName = "";

                syncContext.Send(o =&amp;gt; ((ViewModel)LoadPropForm.DataContext).CheckPendingChanges(ref needToSaveDocumentChanges, ref fileName), null);

                if (needToSaveDocumentChanges)
                {
                    //Check if filename still exists:
                    if((from Document doc in AddInServer.InvApp.Documents
                           where doc.FullDocumentName.Equals(fileName, StringComparison.CurrentCultureIgnoreCase)
                           select doc).Any())
                    {
                        //post is fire and forget !
                        syncContext.Post(o =&amp;gt;
                        {
                            ((ViewModel)LoadPropForm.DataContext).Model.AcceptChanges();
                            ((ViewModel)LoadPropForm.DataContext).SchematikData.UpdateInventor();
                            ((ViewModel)LoadPropForm.DataContext).SchematikData.AcceptChanges();

                        }, null);
                    }
                    else
                    {
                        MessageBox.Show($"Le document: {System.IO.Path.GetFileNameWithoutExtension(fileName)}{System.Environment.NewLine}A été fermé. Les changements ont été perdus", "PropModel", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
                    }

                }

            }



        }&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 10 Mar 2022 13:08:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/wpf-window-inside-an-inventor-add-in/m-p/10996298#M111445</guid>
      <dc:creator>yan.gauthier</dc:creator>
      <dc:date>2022-03-10T13:08:45Z</dc:date>
    </item>
  </channel>
</rss>

