PaletteSet is not triggered by VS22.

PaletteSet is not triggered by VS22.

jawadsjaber
Observer Observer
955 Views
4 Replies
Message 1 of 5

PaletteSet is not triggered by VS22.

jawadsjaber
Observer
Observer

Hi
I am trying to play with one WPF sample, there is PaletteSet in it.

However, after loading the correct namespace, PaletteSet is not recognised. See below image

Is this because I use trial version of AutoCAD.

 

jawadsjaber_0-1703428670981.png

 

 

0 Likes
Accepted solutions (1)
956 Views
4 Replies
Replies (4)
Message 2 of 5

Alexander.Rivilis
Mentor
Mentor
Accepted solution

It is look like you missing reference to  AcMgd.dll

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 5

jawadsjaber
Observer
Observer
Thanks a lot Alexander for your help.
It actually worked!
0 Likes
Message 4 of 5

Norman_Yuan
Mentor
Mentor

Additional suggestions besides what Alexander has said:

 

1. Do not create a "raw" PaletteSet in the CommandClass/IExtensionApplication. Always subclass the PaletteSet for your own custom PaletteSet, wrap the code for creating itself inside and expose features required for business operation as properties/methods.

 

2. Unless you use very old AutoCAD (probably Acad2010 or older), there is no need to use System.Windows.Forms.Integration.ElementHost to add WPF UserControl to PaletteSet as Palette. WPF UserControl can be added as Palette with PaletteSet.AddVisual() method directly.

 

Something like:

 

public class MyPaletteSet : PaletteSet

{

    private MyWpfControl _palette;

   // Constructor

   public MyPaletteSet(...) : base(...)

   {

      // set PaletteSet size/style/docking

      ... ...

      // Add WFP Palette

      _palette = new MyWpfControl();

      AddVisual("[palette name]", _palette);

   }

   // you can expose the WFP control to outside as Property

   public MyWpfControl CustomPalette => _palette;

   // other properties/methods

   ... ... 

}

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5

jawadsjaber
Observer
Observer

Thanks @Norman_Yuan  for these great and professional advices.

Actually this sample was from AU2015..


If you can direct me to some samples based on the latest AutoCAD integration with WPF, it would be greatly appreciated as well.

0 Likes