Creating a drop-down menu with radio buttons

I am creating a WPF application that has the ability to use different sorting algorithms. Currently, it can only use QuickSort, but I want to implement a functionality that allows the user to click on a drop-down menu, which will then display all the different types of sorting algorithms. When the user selects one, and the 'Sort' button is clicked, it will use that method.

How can I create a drop-down menu with radio buttons as items inside, and only one radio button can be selected at a time?

A rough sketch of what I'd like: sketch

Have done a dig around on Google looking for answers, but all I can find are dead links and/or outdated methods. This stack overflow page is similar to what I'm looking for, however instead of buttons inside the drop-down menu, I'm looking for radio buttons.

- - Source


answered 1 week ago Noceo #1

As stated by @canton7, use a normal combo box. I would suggest starting out with the simplest possible version, without any fancy visual (like the checkbox in your drawing).

Google "ComboBox WPF" to get started.

answered 1 week ago Pavel Anikhouski #2

You can create a WPF menu and than override each menu item with your own template (DockPanel or StackPanel with any buttons images you want)

<Menu  Name="name"  Visibility="Hidden"HorizontalAlignment="Left"      VerticalAlignment="Top">
    <MenuItem >

comments powered by Disqus