2

我使用 RibbonControlsLibrary。如何将一个 RibbonGroup 向右对齐?它应该只是选项卡中的一组。所有其他组应与左侧对齐。

4

5 回答 5

2

您不能将 RibbonGroup 向右对齐。功能区不提供执行此操作的功能。

你可以做的是对齐页眉项目......但我不知道它是否对你来说足够: DevExpress

于 2012-07-27T11:04:21.333 回答
1

I had the same issue, and I finally found something to do this :

I have 3 RibbonGroupBox. Groupe1 may be aligned on left, Groupe3 may be aligned on right. Groupe2 is just an empty RibbonGroupBox I inserted between Groupe1 and Groupe3.

Code XAML :

<Fluent:Ribbon DockPanel.Dock="Top" Title="{x:Static p:Resources.MiseEnBarre}"  x:Name="mainRibbon">
            <Fluent:RibbonTabItem x:Name="MainMenu" Header="{x:Static p:Resources.MainMenu}" SizeChanged="MainMenu_SizeChanged">
                <Fluent:RibbonGroupBox x:Name="Groupe1">
                    <Fluent:Button x:Name="autoNest"  SizeDefinition="Large" LargeIcon="img\image_bar_Nesting.png" Header="{x:Static p:Resources.MenuAutoNest}" Click="AutoNest_Click" />
                    <Fluent:Button x:Name="saveFile"  SizeDefinition="Large" LargeIcon="img\image_save.png" Header="{x:Static p:Resources.MenuSauvegarder}" Click="Sauvegarder_Click" />
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox x:Name="Groupe2">
                    
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox x:Name="Groupe3">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Grid.Column="0" Text="{Binding Path=AvailableCNClist}" HorizontalAlignment="Left"/>
                        <TextBlock Grid.Column="1" Text="{Binding Path=AvailableCNClist2}" HorizontalAlignment="Right"/>
                    </Grid>
                </Fluent:RibbonGroupBox>

            </Fluent:RibbonTabItem>
        </Fluent:Ribbon>

Then to manage the Windows redimensioning, I add on my main window the event SizeChanged="MainWindow_SizeChanged" (In the case your RibbonGroupBox dimensions could also change, just add the same event on them).

private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            UpdateAlignRibbon();
        }

        private void UpdateAlignRibbon()
        {
            Groupe2.Width = MyWindow.ActualWidth - Groupe1.ActualWidth - Groupe3.ActualWidth;
        }

In my case the Groupe3 RibbonGroupBox may change of dimension, so I call UpdateAlignRibbon() from 3 points :

  • After Initialization of my window(including defining the GroupBoxes content)
  • When the MainWindow has its dimensions changed
  • When Groupe1 or Groupe3 have its dimensions changed
于 2018-07-12T06:23:55.383 回答
0

Rover,您可以尝试在最后一个左侧 RibbonGroup 和 Right align RibbonGroup 之间添加 RibbonGroup,并将大小分配给与窗口大小相关的新添加的功能区。

例子 <RibbonGroup Width="400"></RibbonGroup>

它看起来如下图

在此处输入图像描述

于 2014-03-27T06:01:56.197 回答
0

您可以进行对齐,但我建议您不要这样做。

                <r:RibbonGroup Header="This is a Filler Header With No Functionality but to Take Up Space" Visibility="Hidden">
                  <s:RibbonButton2/>
                  <s:RibbonButton2/>
                  <s:RibbonButton2/>
                  <s:RibbonButton2/>
                </r:RibbonGroup>

客户希望他们的徽标出现在页面顶部的功能区上,但是您在栏上添加的“假”元素越多,缩小窗口大小时“真”元素就会崩溃得越快。

于 2016-04-21T17:08:19.493 回答
0

尝试这个:

<RibbonTab Header="Home" x:Name="rtabHome" FlowDirection="RightToLeft" >
    <RibbonGroup Header="Group">
            <TextBlock Text="Example"/>
     </RibbonGroup>
</RibbonTab>

与 FlowDirection="RightToLeft" 一起使用。

于 2016-07-29T01:17:13.740 回答