Wednesday, April 15, 2009

Separator for Menu Item in XAML (WPF, Silverlight)

Trivial task and yet worth mentioning: You want a separator in your XAML based application (WPF or Silverlight)? Use System.Windows.Controls.Separator. In XAML write as follows:
<Menu ...
  <MenuItem ...
     <MenuItem ...
     <Separator />
In C# use:
using System.Windows.Controls;

Menu menu = new Menu();
menu.Items.Add(new Separator());


Anonymous said...

Thanks--this is exactly what I was looking for!

nnelson631 said...

I don't believe this is supported in Silverlight. WPF only.

Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!