views:

1040

answers:

2

When going through a tutorial, the 'ribbon.ApplicationhMenu' always comes up on the left hand of the screen, rather than the right, as it does in Office 2007, Paint (on Windows 7), and WordPad (on Windows 7).

Is there some way to change this?

Thank you

(Example of the issue is here http://cid-a45fe702de180b23.skydrive.live.com/self.aspx/Public/RibbonAnnoyance.png (as a new user, I can only post 1 hyperlink))

A: 

Are you using the WPF Ribbon from the OfficeUI team?

We are using that one and don't get anything happening like that. Possibly post some of the XAML you are using to create the App Menu.

EDIT: Having a look at your code, i suspect the DockPanel is being a bit silly.

This is how we structure out layout to add the ribbon

<r:RibbonWindow x:Class="MyAssembly.Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
Title="The Title"
Height="450" 
Width="600" >

<Grid x:Name="grdMain">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <r:Ribbon Title="The Title" x:Name="ribbonMain" Grid.Row="0">
        <!--Quick Access Toolbar-->
        <r:Ribbon.QuickAccessToolBar>
            <r:RibbonQuickAccessToolBar>
            </r:RibbonQuickAccessToolBar>
        </r:Ribbon.QuickAccessToolBar>

        <!--Application Menu-->
        <r:Ribbon.ApplicationMenu>
            <r:RibbonApplicationMenu x:Name="mnuApplication">
                <!--App Menu Items-->
                <r:RibbonApplicationMenu.Items>
                </r:RibbonApplicationMenu.Items>
                <!--App Menu Recent Item List-->
                <r:RibbonApplicationMenu.RecentItemList>
                    <StackPanel>
                        <r:RibbonLabel>Recent Items</r:RibbonLabel>
                        <r:RibbonSeparator/>
                        <r:RibbonHighlightingList x:Name="lstRecentItems"/>
                    </StackPanel>
                </r:RibbonApplicationMenu.RecentItemList>
                <!--App Menu Footer-->
                <r:RibbonApplicationMenu.Footer>
                </r:RibbonApplicationMenu.Footer>
            </r:RibbonApplicationMenu>
        </r:Ribbon.ApplicationMenu>
    </r:Ribbon>

    <Grid Grid.Row="1">
      <!--This is the aread under the ribbon. Place layout things inside of this space-->
    </Grid>
</Grid> </r:RibbonWindow> <!--This is closing tag is on this line as SO is being silly-->

As I mentioned, I suspect the DockPanel is being just abit silly, tho it's a bit late (12am) for me to test it right now. Try copying this code into your XAML and see what happens.

To be frank, I don't trust DockPanels a whole lot, Grids work much better for me :D

Alastair Pitts
+1  A: 

Thank you for your reply. Yes, I am using the Ribbon / FluentUI from the Office Team

Sorry, I was unable to log-on to the 'M.Ahrens' account that I create about 22 hours ago (it wasn't an OpenID one, and I am unsure how to log on without an OpenID, so I am now made my self an OpenID).

I was unable to post the link to the tutorial previously (as a new user can only post 1 hyperlink), but here it is: http://www.renevo.com/blogs/dotnet/archive/2009/02/10/your-first-wpf-ribbon-application.aspx

It doesn't just happen in this tutorial, it happens in every other ribbon app that I make (including Microsoft samples). I have tried the flowing:

*HorizontalAlignment="Right"

*HorizontalContentAlignment="Right"

*FlowDirection="RightToLeft" (makes the ApplicationMenu go to the right, but switches the columns around)

*Default

But it doesn't seem to make a different, the ApplicationMenu is still on the 'left' hand side (unless I maximize the window).

M.Ahrens

+++++++++++++++++++++++++

Edit (added a code sample):

<r:RibbonWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    Height="400" Width="400">

    <DockPanel>
        <r:Ribbon DockPanel.Dock="Top">
            <r:Ribbon.ApplicationMenu>
                <r:RibbonApplicationMenu>
                </r:RibbonApplicationMenu>
            </r:Ribbon.ApplicationMenu>
        </r:Ribbon>
    </DockPanel>
</r:RibbonWindow>
can you post a selection of your XAML code? This will make attempting to find the problem significatly easier.
Alastair Pitts
The Sample Provided produces this error:http://cid-a45fe702de180b23.skydrive.live.com/self.aspx/Public/RibbonAnnoyance3.png
I've updated my original answer with my XAML code.
Alastair Pitts
(I can't seem to post a comment on your answer, and as I can only post 1 hyperlink, I will post my comment here).Thank you for your reply, (I must have gone to bed about 10 minutes before you posted it) I tried it out, but I needed to remove the 'App Menu Footer' as it wouldn't allow it to be empty. Sadly, this still brings the same 'error' or 'annoyance'. I have posted a screenshot (http://cid-a45fe702de180b23.skydrive.live.com/self.aspx/Public/RibbonAnnoyance4.png).
Wow... hrm, The only other thing I can think of is some kind of system wide Right-to-left text setting. Is the system language English?I haven't seen this before and I can't seem to replicate it.
Alastair Pitts
The system language is Australia-English and I am running Windows 7 RTM Enterprise. So the code that you posted *doesn't* cause the same 'error' / 'annoyance' that I am getting?
nope. That is a direct copy of the code from our application (with all the buttons removed etc). I'm also running an Australia-English and both the Win7 RC and the Win7 RTM Pro.Have you tried it without the Office07 skin? I admit i'm clutching at straws here but I just can't find any reason why this would be behaving this way.
Alastair Pitts
All of the previous times that I was getting an error, be it with (like the first post, as 'm.ahrens'), or the code from you, all caused the ribbon application menu to behave like this. I think I will go try it on another different computer, ands see if it works better there.
I have checked on Windows XP (with the help of Windows XP Mode), and oddly it works, see the screenshot (http://cid-a45fe702de180b23.skydrive.live.com/self.aspx/Public/WinXPv7.png).The only thing that may have something to do with it, is that I have .NET framework 4.0 Beta installed??? (I am using .NET 3.5 and I believe that the ribbon projects that I was trying previously, before .net4 also created the error, but I am not certain).
thats very interesting, re: 4.0 Beta. I don't have it installed myself so I can't check this out. My only suggestion is (if possible) to uninstall the 4.0 BETA and check it.
Alastair Pitts
I'm sorry to hear that mate. Apologies for error, i was under the impression (from a MSDN blog) that the uninstall of 4.0 beta was ok. Apparently not.If possible, could you make the basic project available for download somewhere so I can test it out. Hopefully we can narrow it down to your machine.
Alastair Pitts
Yes that would be great, I don't think that uploading it will help, as making a brand new 3.5 project with the sample code you provided, and the *.exe doesn't display the ribbon applicationmenu correctly, but XP does.