Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a group of radio menu items in WPF?

WPF seems to be lacking a RadioMenuItem class or similar functionality. In Windows.Forms, menu items had a RadioChecked property, but WPF menu items only have IsChecked. I can put actual RadioButtons in a MenuItem, but this feels weird and looks awkward.

How can I create a group of menu items that function like radio buttons in a WPF menu? For reference, see the "Zoom" menu in IE8.

like image 808
Matthew Avatar asked Jun 06 '11 13:06

Matthew


2 Answers

Change the Template of the MenuItem to display a RadioButton instead of the standard display

like image 63
Rachel Avatar answered Oct 17 '22 18:10

Rachel


I found this and StatckOverflow post another post with Google and neither had an answer that worked for me.

You don't want to use the Template you want to use the ItemContainerStyle.

I put the answer on the other stack overflow post: https://stackoverflow.com/a/11497189/375727

like image 21
Rhyous Avatar answered Oct 17 '22 20:10

Rhyous