<?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: Adding properties to dockable pane in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9521145#M34200</link>
    <description>&lt;P&gt;1) Create XAML page with code behind that implements&amp;nbsp;IDockablePaneProvider&lt;/P&gt;&lt;P&gt;2) Create a new item of (1) non-static and assign it to a public static variable in your class that registers the pane (IExternalApplication)&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Pass the non-static variable as an argument to&amp;nbsp;Application.RegisterDockablePane&lt;/P&gt;&lt;P&gt;4) Access the static variable of your pane to update it from IExternalCommand class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the order I found works for me. However it would seem logical to pass the static variable directly into&amp;nbsp;Application.RegisterDockablePane. Probably I tried this and perhaps it didn't work but I don't see why it wouldn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 May 2020 18:27:45 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2020-05-16T18:27:45Z</dc:date>
    <item>
      <title>Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9521061#M34199</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've a routine I created for Revit which opens certain views - this uses Win Forms a modeless dialog.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've decided to update this to a dockable pane, and so I'm in the process of moving it to WPF (and learning WPF!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Originally, when using a Form, I passed several variables to it, I did this by creating some properties in the Form class, i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        public List&amp;lt;ElementId&amp;gt; getAllSheets_IDs
        {
            get;
            set;
        }&lt;/LI-CODE&gt;&lt;P&gt;When the External Command ran I created the form with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;var myForm = new Form1();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I could access the property with myForm.getAllSheets_IDs - this worked well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now moving to WPF, I have to register the dockable pane in the&amp;nbsp;App : IExternalApplication class which I understand runs when Revit loads (as the docable form needs to be registered in a zero doc state).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This means that the instance of my pane is created in&amp;nbsp;App : IExternalApplication class and I cannot access it from the&amp;nbsp;class Command : IExternalCommand hence I cannot access any properties of it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can pass data to the pane?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope my explanation above make sense, I'm a bit of a noob at this!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 16:57:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9521061#M34199</guid>
      <dc:creator>Kevin.Bell</dc:creator>
      <dc:date>2020-05-16T16:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9521145#M34200</link>
      <description>&lt;P&gt;1) Create XAML page with code behind that implements&amp;nbsp;IDockablePaneProvider&lt;/P&gt;&lt;P&gt;2) Create a new item of (1) non-static and assign it to a public static variable in your class that registers the pane (IExternalApplication)&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Pass the non-static variable as an argument to&amp;nbsp;Application.RegisterDockablePane&lt;/P&gt;&lt;P&gt;4) Access the static variable of your pane to update it from IExternalCommand class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the order I found works for me. However it would seem logical to pass the static variable directly into&amp;nbsp;Application.RegisterDockablePane. Probably I tried this and perhaps it didn't work but I don't see why it wouldn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 18:27:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9521145#M34200</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-05-16T18:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9522089#M34201</link>
      <description>&lt;P&gt;Hi RPTHOMAS108, thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to follow what you've said:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;1) Create XAML page with code behind that implements&amp;nbsp;IDockablePaneProvider&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;OK, I've created a WPF form, which is XAML, the .XAML.CS code behnd it impliments IDockablePaneProvider with:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;   public partial class NewBrowserPane : UserControl, IDockablePaneProvider
    {
        public void SetupDockablePane(DockablePaneProviderData data)
        {
            data.FrameworkElement = this as FrameworkElement;
            data.InitialState.DockPosition = DockPosition.Tabbed;
            data.InitialState.TabBehind = Autodesk.Revit.UI.DockablePanes.BuiltInDockablePanes.ElementView;
        }

        public NewBrowserPane()
        {
            InitializeComponent();
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;2) Create a new item of (1) non-static and assign it to a public static variable in your class that registers the pane (IExternalApplication)&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;OK, I believe I've done this in IExternalApplication with, I've created a public static variable - myPane, when I create the panelId I then assign it to myPane&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    class App : IExternalApplication
    {
        public static DockablePaneId myPane
        {
            get;
            set;
        }        

        public Result OnStartup(UIControlledApplication a)
        {
            //Register dockable pane
            NewBrowserPane page1 = new NewBrowserPane();
            DockablePaneId paneId = new DockablePaneId(new Guid("9d7ed357-534f-4d87-afc4-8e784e3b119e"));

            myPane = paneId;

            a.RegisterDockablePane(paneId, "Test", (IDockablePaneProvider)page1);

            return Result.Succeeded;
        }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;3) Pass the non-static variable as an argument to&amp;nbsp;Application.RegisterDockablePane&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm stuck on this bit, I believe I should change&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a.RegisterDockablePane(paneId, "New Browser", (IDockablePaneProvider)page1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a.RegisterDockablePane(paneId, "New Browser", (IDockablePaneProvider)page1, myPane)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I can't access the definition of RegisterDockablePane to add the myPane arguement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I following your instructions correctly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 15:27:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9522089#M34201</guid>
      <dc:creator>Kevin.Bell</dc:creator>
      <dc:date>2020-05-17T15:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9522502#M34202</link>
      <description>&lt;P&gt;There are a couple of things wrong with your implementation as far as I can see:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You should be using a WPF Page not a UserControl for the pane content&lt;/LI&gt;&lt;LI&gt;DockablePaneId should be provided as a class level static variable&lt;/LI&gt;&lt;LI&gt;Should try casting Pane to IDockablePaneProvider when passing into RegisterDockablePane&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;For comparison I've created a project with a basic implementation for dockable pane this has a separate IExternalCommand&amp;nbsp; (External Tools dropdown on Add-ins tab) which will update the pane with the time. Dockable panes would usually be used in conjunction with idling event to update them and ExternalEvent to take instructions from them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 21:25:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9522502#M34202</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-05-17T21:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9571292#M34203</link>
      <description>&lt;P&gt;Thanks for your response, I'll review your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One point about userControl vs WPF Page, when I click 'Add' and 'New Item' in Visual Studio I only get the option to add a userControl, WPF Page is not listed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though I see on the code that you sent, when I click Add New Item, WPF Page is listed. It appears that something in my solution is preventing Visual Studio from giving the option of adding a WPF Page?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 08:37:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9571292#M34203</guid>
      <dc:creator>Kevin.Bell</dc:creator>
      <dc:date>2020-06-10T08:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9571401#M34204</link>
      <description>&lt;P&gt;Sounds like you started with the wrong template.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you pick a .Net Framework class library it assumes you want to use Window.Forms. Now it is slightly more complicated with the addition of .Net Core and .Net Standard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Historically I always created a WPF class library by starting a WPF Application project type and switching the Output type to Class Library then deleting&amp;nbsp; the files associated with an application i.e. App.xaml and App.config.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have the WPF project started in such a way you then save it as a template.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 09:24:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9571401#M34204</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-06-10T09:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Adding properties to dockable pane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9572182#M34205</link>
      <description>&lt;P&gt;Oh, OK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the Revit addin template by The Building Coder:&amp;nbsp;&lt;A href="https://thebuildingcoder.typepad.com/blog/2018/09/revit-2019-visual-studio-net-add-in-wizards.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2018/09/revit-2019-visual-studio-net-add-in-wizards.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thats obvioudly set up for Windows Forms as you say... I'll have to create a new one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:58:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/adding-properties-to-dockable-pane/m-p/9572182#M34205</guid>
      <dc:creator>Kevin.Bell</dc:creator>
      <dc:date>2020-06-10T14:58:16Z</dc:date>
    </item>
  </channel>
</rss>

