Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

RE: Loading Menu and Toolbar Items From a Resource File(Page?) in WPF<1163454875.783518.140940@m73g2000cwd.googlegroups.com>

Closed Thread
 
Thread Tools Display Modes
Old 11-21-2006   #1 (permalink)
John Vanderburg
Guest


 

RE: Loading Menu and Toolbar Items From a Resource File(Page?) in WPF<1163454875.783518.140940@m73g2000cwd.googlegroups.com>

I had trouble with this as well, but finally figured it out. Here's what I did.

1. Menu defined in resource file
<Application.Resources>
<!-- Menu and Context menu resources -->
<Menu x:Key="Menu.File">
<MenuItem Header="_File" >
<MenuItem Header="E_xit" Command="{x:Static pw:ApplicationCommands.Exit}" />
</MenuItem>
</Menu>
</Application.Resources>

2.Reference the menu resource in a Window
<DockPanel x:Name="DockPanel" LastChildFill="False">
<ToolBarTray DockPanel.Dock="Top" MinHeight="24" x:Name="ToolBarTray">
<ToolBar x:Name="Standard">
<StaticResource ResourceKey="Menu.File" />
</ToolBar>
</ToolBarTray>
</DockPanel>

You should be able to reference icons/images, etc in a similar manner.

Hope this helps

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Send To Context Menu - Restore Default Menu Items Brink Tutorials 4 1 Week Ago 04:34 PM
Missing Start Menu/Toolbar and desktop items! caraz Vista General 1 02-16-2008 07:25 AM
Toolbar with menu as toolbar item Yoavo Avalon 0 10-18-2007 09:12 AM
loading Markup::XamlReader::Load from resource file John Dunn Avalon 14 12-05-2006 01:04 AM
Loading Menu and Toolbar Items From a Resource File (Page?) in WPF Bree Avalon 3 11-28-2006 10:25 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50