Quantcast
Channel: Problem in menuitem
Viewing all articles
Browse latest Browse all 3

Problem in menuitem

0
0
Hi ,
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

Viewing all articles
Browse latest Browse all 3

Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.2 by Vimeo.com, Inc.

Vimeo 10.6.2 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Re:

Re:





Latest Images

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.1 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Vimeo 10.6.0 by Vimeo.com, Inc.

Re:

Re:

Re:

Re: