Creating buttons on a tab in .NET 8.0.

Creating buttons on a tab in .NET 8.0.

rhavrys
Participant Participant
684 Views
8 Replies
Message 1 of 9

Creating buttons on a tab in .NET 8.0.

rhavrys
Participant
Participant

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

0 Likes
Accepted solutions (1)
685 Views
8 Replies
Replies (8)
Message 2 of 9

jeremy_tammik
Alumni
Alumni

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
0 Likes
Message 3 of 9

rhavrys
Participant
Participant

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.

0 Likes
Message 4 of 9

rhavrys
Participant
Participant

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

 
0 Likes
Message 5 of 9

jeremy_tammik
Alumni
Alumni
Accepted solution

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
0 Likes
Message 6 of 9

jeremy_tammik
Alumni
Alumni

Yes, of course, squared.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 7 of 9

rhavrys
Participant
Participant

Here what I got(

0 Likes
Message 8 of 9

rhavrys
Participant
Participant

Screenshot_1.png

0 Likes
Message 9 of 9

jeremy_tammik
Alumni
Alumni

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
0 Likes