<?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 User conrol into Palette with C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11960175#M35928</link>
    <description>&lt;P&gt;But how do you get the index value of a specific palette if they are reordered whenever one is activated? Is there a way to get the index by name or something? I dont see any methods in the object model.&lt;BR /&gt;&lt;BR /&gt;say you have 4 palettes in the set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var multiplePaletteSet = new PaletteSet();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette1 = multiplePaletteSet .AddVisual("Palette1", wpfForm1);&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette2 = multiplePaletteSet .AddVisual("Palette1", wpfForm2);&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette3 = multiplePaletteSet .AddVisual("Palette1", wpfForm3);&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette4 = multiplePaletteSet .AddVisual("Palette1", wpfForm4);&lt;BR /&gt;&lt;BR /&gt;so now user clicks around between the palette tabs, effectively changing the active palette dynamically, but on a specific user action in one of the palettes, I need to remove a different palette from the paletteset. How do I find/select/identify a palette if it is not the active one?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Remove(2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2023 16:52:56 GMT</pubDate>
    <dc:creator>jtibbetts73</dc:creator>
    <dc:date>2023-05-12T16:52:56Z</dc:date>
    <item>
      <title>Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6349551#M35921</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to add a user control to a palette. I used the below method sucessfully with VB.net but it is not working with C#. &amp;nbsp;the mainPalette.add() method is throwing up :&amp;nbsp;Error 5 The best overloaded method match for 'Autodesk.AutoCAD.Windows.PaletteSet.Add(string, System.Uri)' has some invalid arguments&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static PaletteSet mainPalette = null;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;[CommandMethod("POCFind")]&lt;BR /&gt;public static void pocfind()&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;if (mainPalette == null)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;POCForm mainForm = new POCForm();&lt;BR /&gt;mainPalette = new PaletteSet("POC ADD");&lt;BR /&gt;mainPalette.Add("TEST", mainForm);&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;mainPalette.Visible = true;&lt;BR /&gt;&lt;BR /&gt;// populateDatabaseFromCSVAsync();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 23:14:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6349551#M35921</guid>
      <dc:creator>deusextechnic</dc:creator>
      <dc:date>2016-05-25T23:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6349597#M35922</link>
      <description>Is the POCForm a UserControl?</description>
      <pubDate>Thu, 26 May 2016 00:31:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6349597#M35922</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-05-26T00:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6349991#M35923</link>
      <description>&lt;P&gt;Yes. Judging by the error message, it seems to be trying to use it as an Uri. I can't see any reason it would do this. Like I said, I simply translated a snip of VB.net that i succesfully used previously to C#. &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 08:44:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6349991#M35923</guid>
      <dc:creator>deusextechnic</dc:creator>
      <dc:date>2016-05-26T08:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6350068#M35924</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PaletteSet.Add() method is to be used with UserControl deriving from System.Windows.Forms.UserControl (i.e. Winform UserControl).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If he POCform class derives&amp;nbsp; from &lt;SPAN class="selflink"&gt;System.Windows.Controls&lt;SPAN&gt;.&lt;/SPAN&gt;(i.e. &lt;/SPAN&gt;WPF UserControl), you have to use PaletteSet.AddVisual() method.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 10:22:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6350068#M35924</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-05-26T10:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6350913#M35925</link>
      <description>That was it. Thanks.</description>
      <pubDate>Thu, 26 May 2016 16:58:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/6350913#M35925</guid>
      <dc:creator>deusextechnic</dc:creator>
      <dc:date>2016-05-26T16:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11955258#M35926</link>
      <description>&lt;P&gt;How can you dynamically remove a user control from the paletteset? I don't see a remove method in the object browser&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 19:06:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11955258#M35926</guid>
      <dc:creator>jtibbetts73</dc:creator>
      <dc:date>2023-05-10T19:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11955477#M35927</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5531228"&gt;@jtibbetts73&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_Windows_PaletteSet_Remove_int" target="_blank" rel="noopener"&gt;PaletteSet.Remove&lt;/A&gt;(int index) method.&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 21:03:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11955477#M35927</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-10T21:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11960175#M35928</link>
      <description>&lt;P&gt;But how do you get the index value of a specific palette if they are reordered whenever one is activated? Is there a way to get the index by name or something? I dont see any methods in the object model.&lt;BR /&gt;&lt;BR /&gt;say you have 4 palettes in the set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var multiplePaletteSet = new PaletteSet();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette1 = multiplePaletteSet .AddVisual("Palette1", wpfForm1);&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette2 = multiplePaletteSet .AddVisual("Palette1", wpfForm2);&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette3 = multiplePaletteSet .AddVisual("Palette1", wpfForm3);&lt;/P&gt;&lt;P&gt;var multiplePaletteSet .Palette4 = multiplePaletteSet .AddVisual("Palette1", wpfForm4);&lt;BR /&gt;&lt;BR /&gt;so now user clicks around between the palette tabs, effectively changing the active palette dynamically, but on a specific user action in one of the palettes, I need to remove a different palette from the paletteset. How do I find/select/identify a palette if it is not the active one?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Remove(2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 16:52:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11960175#M35928</guid>
      <dc:creator>jtibbetts73</dc:creator>
      <dc:date>2023-05-12T16:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding User conrol into Palette with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11960493#M35929</link>
      <description>&lt;P&gt;Firstly, you really should not directly instantiate a PaletteSet object. Instead, always derive your custom one from PaletteSet class. In the derived class, you can track which Palette is currently the active one, and do the Palette adding/removing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To tracking which Palette is the currently active one, you handle PaletteSet.PaletteActivated event.&lt;/P&gt;
&lt;P&gt;For example, with that event handler, you would have a class member "currentPalatteName". Then, when you remove Palette, you do:&lt;/P&gt;
&lt;P&gt;for (int i=0; i&amp;lt;this.Count; i++)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var name=this[i].Name;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if (name!=currentPaletteName &amp;amp;&amp;amp; name==[PaletteNameToRemove])&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; this.RemoveAt(i);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; break;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 19:36:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/adding-user-conrol-into-palette-with-c/m-p/11960493#M35929</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-05-12T19:36:33Z</dc:date>
    </item>
  </channel>
</rss>

