How to add header to MS Ribbon's Application Menu

孤街浪徒 提交于 2019-12-13 18:23:20

问题


I am trying to replicate WordPad Application Menu and add a header to the RibbonApplicationMenu. But the header never show. Where do I add this header to the Application Menu (e.g. in WordPad, header shows "Recent Document"

<ribbon:RibbonApplicationSplitMenuItem Header="Select an Option to export" ImageSource="image1.png" >
    <ribbon:RibbonApplicationMenuItem Header="PDF" ImageSource="image2.png" />
    <ribbon:RibbonApplicationMenuItem Header="Excel" ImageSource="image3.png />
</ribbon:RibbonApplicationSplitMenuItem>

回答1:


Try this

   <Ribbon:Ribbon Grid.Row="0">
            <Ribbon:Ribbon.ApplicationMenu>
                <Ribbon:RibbonApplicationMenu>
                    <Ribbon:RibbonApplicationMenu.AuxiliaryPaneContent>
                        <Grid MinHeight="500">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="30"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="0" BorderBrush="DarkBlue" BorderThickness="0,0,0,1">
                                <StackPanel  
                                        Orientation="Vertical">
                                    <Label Foreground="DarkBlue" HorizontalAlignment="Left" VerticalAlignment="Center" HorizontalContentAlignment="Left"
                                       VerticalContentAlignment="Center" Content="Hello World"  />
                                </StackPanel>
                            </Border>
                            <ListBox Grid.Row="1">
                                <ListBoxItem>List Box Item 1</ListBoxItem>
                                <ListBoxItem>List Box Item 2</ListBoxItem>
                                <ListBoxItem>List Box Item 3</ListBoxItem>
                                <ListBoxItem>List Box Item 4</ListBoxItem>
                            </ListBox>
                        </Grid>
                    </Ribbon:RibbonApplicationMenu.AuxiliaryPaneContent>
                    <Ribbon:RibbonApplicationMenuItem Header="Hello _Ribbon"   ImageSource="Images\LargeIcon.png"/>
                    <Ribbon:RibbonApplicationMenuItem Header="Hello _Ribbon"   ImageSource="Images\LargeIcon.png"/>
                    <Ribbon:RibbonApplicationMenuItem Header="Hello _Ribbon"   ImageSource="Images\LargeIcon.png"/>
                </Ribbon:RibbonApplicationMenu>

            </Ribbon:Ribbon.ApplicationMenu>


        </Ribbon:Ribbon>

It gives me this



来源:https://stackoverflow.com/questions/6881617/how-to-add-header-to-ms-ribbons-application-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!