Pregunta

I have tried to play with the new WPF Ribbon control available in the .NET 4.5 Beta together with the Visual Studio 11 Beta. But there is one thing that is confusing me.

MSDN Ribbon Class

When we add just such simple XAML:

<Window x:Class="WpfApplication2.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<StackPanel>
    <Ribbon>
    </Ribbon>
</StackPanel>

Then we get our Ribbon (as it was expected), but such Ribbon have one element by default - and this is the annoying part. It looks similar to the RibbonApplicationMenu object, but I am not able to add there any children or event delete this guy. It is expanding vertically when we click the down arrow (you can see it on the picture below).

http://s17.postimage.org/3lvh8wyb3/ribbon4_5.png

Anyone have any idea how to remove this object? Or maybe how to use it? When I try to make example from the MSDN site, all of them works fine, expect the fact that this default element is present together with my stuff witch I have added in XAML. Anyone have tried the same? Thank you for help.


Yes, that's true. Maybe I was not very precise in my question. All in all you have helped mi to solve this issue. My problem exist because I was using the <RibbonApplicationMenu> tag instead of <Ribbon.ApplicationMenu> as in your example. This cause that I was obtaining a brand new application menu besides the default one - that's why I was confused and I want to delete it. Anyway, thank You for help!

¿Fue útil?

Solución

You can use it as:

   <Ribbon>
        <Ribbon.ApplicationMenu>
            <RibbonApplicationMenu SmallImageSource="..." >
                <RibbonApplicationMenuItem Header="New" Click="New_Click" ImageSource="..." />
                <RibbonApplicationMenuItem Header="Open" Click="Open_Click" ImageSource="..." />
                <RibbonApplicationMenuItem Header="Save" Click="Save_Click" ImageSource="..." />

I suggest not to delete it, every standard ribbon has an application menu.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top