How to use ToggleButton in .NET Core Project

  • Thread starter Thread starter zydjohn
  • Start date Start date
Z

zydjohn

Guest
Hello:

I have one .NET Core project, in which I need one ToggleButton to show the current state of my program, it is it running, then shows “On”, if not, then shows “Off”.

I found in this article:

ToggleButton Class (System.Windows.Controls.Primitives)

that ToggleButton class should work in .NET core 3.0, 3.1. I am using Visual Studio 2019 Version 16.7.6 on Windows 10 Version 2004 (OS Build 19041.572). I can use .NET core 3.1.

But I can’t find any code example for .NET core.

However, I found one WPF example for using ToggleButton, as you can see in the picture.

I want to create a small test .Net core (Windows Forms) app project to use ToggleButton, so I can decide the size of the button and the color and the text inside the toggle button.

For example, when the programs begins, I can set the beginning size to the biggest size (like 20) and the initial text to “Off”, then change it to “On” when I click on the toggle button.

I have no idea how to do this, should I install a nuget package for it? But for which nuget package? And how I can write the code to reach my goal?

Please advise.



1622252.png

Continue reading...
 
Back
Top