Building an iOS Style Toggle Button in WPF and XAML

Mark Harwood
Jun 21, 2021

Hi Everyone,

I wanted to share a neat custom button I created in XAML for a WPF program. I wanted a toggle button that looked very similar to the iOS toggle button but either couldn’t find any online or didn’t want to steal someone else's code.

I wanted this to be a learning experience rather than another step into tutorial hell.

I also wanted a button that could be resized to any dimension and still look correct 🤞

This is the XAML I used to create the button:

Finally, here is a GIF of the button 🥳

Thank you for reading! Any questions, let me know 👍

--

--

Mark Harwood

IT Pro 👨‍💻 Dad 👀 Husband🔒 Check out my free blog or utilise my expertise on the web! https://mharwood.uk