C#: menu item not showing when debugging
So I h开发者_如何学Cave added a "Menu" item to my program and though properties:
IsEnabled: (is checked)
visibility: Visible
And my .xaml shows:
<Grid>
<Menu Height="26" HorizontalAlignment="Left" Margin="-1,0,0,0" Name="menu1" VerticalAlignment="Top" Width="504" Opacity="88">
<MenuItem Header="_Menu"/>
<MenuItem Header="_View"/>
<MenuItem Header="_Edit"/>
</Menu>
</Grid>
When I debug the program the "Menu" or any of the MenuItems does not show up on the Active Windows Form.
Any thoughts?
Add right after your window element <DockPanel Width="Auto" Height="Auto" LastChildFill="True">
And then add this attribute into your menu element: DockPanel.Dock="Top"
Make sure you explicitly save and re-compile your application after making XAML changes.
I've personally had a lot of instances where XAML changes simply did not show up when debugging an application. To be sure your changes are going through, you can clean the solution and rebuild.
I found a technical issue that I straightened out that was causing the problem.
精彩评论