XamWebMenuItem.Icon does not work on top-level menu

rated by 0 users
This post has 2 Replies | 2 Followers

Not Ranked
Points 25
JojitSoriano Posted: 02-03-2009 2:44 AM

I'm trying to display an image beside a top-level menu item. So, I write the XAML as follows:

        <igMenu:XamWebMenuItem x:Name="appMenuNew" Header="New">
          <igMenu:XamWebMenuItem.Icon>
            <Image Source="images/New.png" />
          </igMenu:XamWebMenuItem.Icon>
        </igMenu:XamWebMenuItem>

The image does not display but if I code the same in 2nd-level menu items, the images are displayed. Is this intentional or do I have to do somethings else to work around this?

Just to try doing a workaround this while waiting for your reply to this post, I changed the above xaml to this:

           <igMenu:XamWebMenuItem x:Name="appMenuNew">
                <igMenu:XamWebMenuItem.Header>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="../Images/NewDoc.png" />
                        <TextBlock Text="New"/>
                    </StackPanel>
                </igMenu:XamWebMenuItem.Header>
            </igMenu:XamWebMenuItem>

However, when I resized the Preview and xaml windows, VS2008 crashed and exited.

Top 150 Contributor
Points 2,100
Infragistics Employee

By design the root items in XamWebMenu can't have icons. However, you can do a workaround by using HeaderTemplate. Your code should look something like this:

            <igMenu:XamWebMenuItem x:Name="appMenuNew">
                <igMenu:XamWebMenuItem.HeaderTemplate>
                    <DataTemplate>
                         <StackPanel Orientation="Horizontal">
                             <Image Source="../Images/NewDoc.png" />
                             <TextBlock Text="New"/>
                         </StackPanel>
                    </DataTemplate>
                </igMenu:XamWebMenuItem.HeaderTemplate>
            </igMenu:XamWebMenuItem>  

Georgi Angelchov

Software Engineer in Test

NetAdvantage for Silverlight LoB

  • | Post Points: 20
Not Ranked
Points 25

This works! Thank you very much Georgi for the help and for the quick reply! I got another problem this time on XamWebSeparator but I think I'll just post it in another thread. Thanks a lot!

  • | Post Points: 5
Page 1 of 1 (3 items) | RSS

Forum Statistics

40,788 users have contributed to 129,818 threads and 144,150 posts.

In the past week, we've had 5,587 new users, adding to our total of 467,632 registered users!

In the past 24 hours, we have 56 new thread(s), 217 new post(s), and

In the past 3 days, the most popular thread for everyone has been "Google Chrome & UltraWebGrid. Compatible or Not? ". The post with the most views is "In wingrid RowFilter dropdown items for DropDown column is not shwing ". The most replies were made to "Google Chrome & UltraWebGrid. Compatible or Not? ".

Please welcome our newest member fceskxv .