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 500 Contributor
Points 1,135
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

29,481 users have contributed to 108,685 threads and 120,800 posts.

In the past week, we've had 1,137 new users, adding to our total of 447,071 registered users!

In the past 24 hours, we have 55 new thread(s), 203 new post(s), and

In the past 3 days, the most popular thread for everyone has been "Ultrawebgrid Drag and Drop". The post with the most views is "Column (Header) selection and ContextMenu with right mouse button click". The most replies were made to "XamChart and Prism".

Please welcome our newest member svandrei.