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: 

Creating buttons on a tab in .NET 8.0.

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
rhavrys
327 Views, 8 Replies

Creating buttons on a tab in .NET 8.0.

Can anyone suggest how to load an icon onto a button in .NET 8.0 if PresentationCore is missing?

8 REPLIES 8
Message 2 of 9
jeremy_tammik
in reply to: rhavrys

I would assume that the code is virtually unchanged from the previous .NET Framework. What do you need PresentationCore for?

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 9
rhavrys
in reply to: jeremy_tammik

PushButton pushButton = CreatePushButton(panel0, typeof(CmdAbout), "About");
pushButton.LargeImage = Converter(Properties.Resources.about_32_32);
pushButton.Image = Converter(Properties.Resources.about_16_16);

For example, LargeImage & Image its presentation core. When I try to set an icon for my buttons, I get an error that PresentationCore is missing. Unfortunately, I couldn't find any answers online on how to do this.

Message 4 of 9
rhavrys
in reply to: jeremy_tammik

Can WPF also be used to create UIs in .NET 8? I heard there were some changes to it as well.

 
Message 5 of 9
jeremy_tammik
in reply to: rhavrys

Image and LargeImage are Revit API properties on the RibbonButton class:

  

  

They are of type ImageSource:

  

  

You can certainly convert to that in .NET Core as well:

   

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 6 of 9
jeremy_tammik
in reply to: rhavrys

Yes, of course, squared.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 9
rhavrys
in reply to: jeremy_tammik

Here what I got(

Message 8 of 9
rhavrys
in reply to: rhavrys

Screenshot_1.png

Message 9 of 9
jeremy_tammik
in reply to: rhavrys

Here is one of the solutions that I pointed out in my previous answer:

  

https://stackoverflow.com/questions/59831243/using-imagesource-in-net-core-3-1

  

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