Hi ,
Mahender
Im facing a problem in showing menu bar in WPF.
Following is the code
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="500" Width="500" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<Window.Resources>
<HierarchicalDataTemplate DataType="Module" ItemsSource="{Binding XPath=*}">
<MenuItem Header="{Binding XPath=@name}" Height="15" StaysOpenOnClick="True" />
</HierarchicalDataTemplate>
<DataTemplate DataType="SubModule" x:Key="TemplateModule" >
<MenuItem Header="{Binding XPath=@name}" Click="MenuItem_Click" >
</MenuItem>
</DataTemplate>
<XmlDataProvider x:Key="dataProvider" XPath="MenuItems" Source="Books.xml">
</XmlDataProvider>
</Window.Resources>
<Grid x:Name="MainGridMenuBar" VerticalAlignment="Top" Background="Transparent">
<Menu Name="MainMenubar" ItemsSource="{Binding Source={StaticResource dataProvider}, XPath=Module}" VerticalAlignment="Top" ></Menu>
</Grid>
</Window>
XML SOurce Look like this
<MenuItems>
<Module id="Mod1" name="P1">
<SubModule id="SubMod1" name="y" />
<SubModule id="SubMod2" name="z" />
<SubModule id="SubMod3" name="z1" />
</Module>
<Module id="Mod2" name="P2">
<SubModule id="SubMod21" name="1" />
<SubModule id="SubMod22" name="2" />
<SubModule id="SubMod23" name="2" />
</Module>
</menuitem>
When i run above code,Menu gets loaded and its fine.But when i click on or mouse hover on menuitems(toplevel),child elements doesnot get loaded immediately and i have click on below tip of menubar for opening child menuitem.
ChildMenuItems doesnot get loaded immediately when i click on header menu...
With regards,
Mahender
Mahender