I am new to WPF. And by new I mean I just started it today after getting .net 3.5. I usually do GUI Development in Windows Forms and like the awesome ToolStripMenu. But when I saw the WPF Menu, it was so ugly that it reminded me of my Win32 Api days. Is there any way to change the style of a WPF menu to make it look like a Windows Forms menu?
Asked
Active
Viewed 9,986 times
9
-
You mean this one (WinForms picture) http://www.code-magazine.com/ArticleImage.aspx?QuickID=0601071&Image=fig_007.gif ? – Roy T. Jun 30 '11 at 07:14
-
1Yup. notice the fancy gradient winforms has on its menus and toolbars – ApprenticeHacker Jun 30 '11 at 07:15
-
i have been waiting for 20 minutes and have got only like 12 views and **ONE RESPONSE?** is everyone dead? – ApprenticeHacker Jun 30 '11 at 07:33
-
1He he - yes I think everyone is dead .. by the way yes you can get the toolstrip to look like the forms one - and even cooler. Did you try the wpf toolstrip? – Rune Andersen Jun 30 '11 at 07:35
-
@burning: maybe [winforms] just doesn't draw a crowd... – H H Jun 30 '11 at 07:42
-
@Rune Does the wpf toolstrip support drop down menus? – ApprenticeHacker Jun 30 '11 at 07:45
2 Answers
6
try this:
An introduction to styling and templating: http://msdn.microsoft.com/en-us/library/ms745683.aspx
A new styling for toolbar http://msdn.microsoft.com/en-us/library/aa970772.aspx
Alternatively search for wpf ToolBar style
Edit: Yes - but add a menu like this and the toolbar alters the menu style (paste in new project):
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<ToolBarTray >
<ToolBar >
<Menu>
<MenuItem Header="Hey">
<MenuItem Header="lo"></MenuItem>
</MenuItem>
<MenuItem Header="Ho">
<MenuItem Header="la"></MenuItem>
</MenuItem>
</Menu>
</ToolBar>
</ToolBarTray>

Rune Andersen
- 1,650
- 12
- 15
-
I wanted to know about menus not toolbars. But still this helps. Thanks! – ApprenticeHacker Jun 30 '11 at 07:54
-
Awesome , thanks! I was wrong about WPF , its even better than windows forms! an upvote and tick! – ApprenticeHacker Jun 30 '11 at 08:18
1
The Menu, like most WPF controls has very little styling by default.
But that's just by default, you can add your own styles and outshine WinForms very easily .
Just a little starter:
<Menu DockPanel.Dock="Top" >
<Menu.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="Blue" Offset="1" />
</LinearGradientBrush>
</Menu.Background>
<MenuItem Header="_File" >

H H
- 263,252
- 30
- 330
- 514
-
-
Yes, with as many points and colors as you like. Also look at ImageBrush, RadialGradientBrush, ... And do use Styles. – H H Jun 30 '11 at 08:22
-
@HenkHolterman Does it have bad effects on memory usage & Performance? – Anirudha Gupta Mar 08 '18 at 07:28