how to create sub menu below menu item in silverlight 4
how to create sub menu below menu item in silverlight 4 my code is as below
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" >
<toolkit:ContextMenu x:Name="menu1" AutomationProperties.AutomationId="menu1" UseLayoutRounding="True" Height="30" >
<toolkit:MenuItem x:Name="Item1" AutomationProperties.AutomationId="Item1" Header="Item 1" HorizontalAlignment="Stretch" FlowDirection="LeftToRight" Background="#0041E4F2" BorderBrush="#00E6FFFF" AllowDrop="True" />
</toolkit:ContextMenu>
<toolkit:ContextMenu x:Name="menu2" AutomationProperties.AutomationId="menu2" UseLayoutRounding="True" Height="30" >
<toolkit:MenuItem x:Name="Item2" AutomationProperties.AutomationId="Item2" Header="Item 2" FlowDirection="LeftToRight" />
</toolkit:ContextMenu>
<toolkit:ContextMenu x:Name="menu3" AutomationProperties.AutomationId="menu3" UseLayoutRounding="True" Height="30">
<toolkit:MenuItem x:Name="Item3" AutomationProperties.AutomationId="Item3" Header="Item 3" FlowDirection="LeftToRight" />
<toolkit:MenuItem x:Name="Item4" AutomationProperties.AutomationId="Item4" Header="Item 4" FlowDirection="LeftToRight" />
</toolkit:ContextMenu>
</Stac开发者_JAVA百科kPanel>
</Grid>
Unfortunately, this feature isn't supported by the current ContextMenu control. You can find more information in this article
That said, please pay attention to the word "subset"; the Toolkit's ContextMenu doesn't have all the features of WPF's quite yet. Notably, it doesn't support multi-level menu item nesting. However, none of the customers I asked felt that nesting was necessary right now, so I don't expect its absence to be a big limitation.
You can also find more information about the control and a possible way to simulate the feature in this article on SilverlightShow. However, the solution doesn't look as expected, so I'm not sure if you will find it useful.
精彩评论