顶部的功能区组标题

发布于 2024-11-26 02:48:06 字数 163 浏览 1 评论 0原文

我试图弄清楚如何实现此处所示的“更好”示例: 在此处输入图像描述

具体用于“缩进”和“间距”标题。我假设它只是一个 RibbonGroup 标头,标头位于顶部,但我不知道如何做到这一点。有想法吗?

I am trying to figure out how to implement the "Better" example of what is shown here:
enter image description here

Specifically what is used for "Indent" and "Spacing" headings. I assume its just a RibbonGroup header with the header on top but I can't figure out how to do that. Ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

べ映画 2024-12-03 02:48:06

它只是一个TextBlock

这似乎直接来自 WPF 源代码和示例

您将在 UserControlWord.xaml 中找到以下内容,我认为这是在您的 Better: 示例中生成整个段落 RibbonGroup 的确切代码。对于非通用的 RibbonButtons 等...它们通常只是在示例中制作自己的普通控件网格。

<ribbon:RibbonGroup Header="Paragraph" KeyTip="ZG">
    <ribbon:RibbonGroup.Resources>
        <!-- Vertical Separator-->                        
        <Style TargetType="{x:Type ribbon:RibbonSeparator}" x:Key="RibbonSeparatorStyleKey">
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <RotateTransform Angle="90"/>                                                                            
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Image -->
        <Style TargetType="{x:Type Image}" x:Key="ImageStyle16Key">
            <Setter Property="Width" Value="16"/>
            <Setter Property="Height" Value="16"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor"/>
        </Style>                                                         
    </ribbon:RibbonGroup.Resources>
    <ribbon:RibbonGroup.GroupSizeDefinitions>
        <ribbon:RibbonGroupTemplateSizeDefinition>                            
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <!-- Indent -->
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Indent" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="0" Name="LeftIndentGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="35"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\DecreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="Left:" HorizontalAlignment="Left" TextAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IL"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="0" Name="RightIndentGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="35"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\IncreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="Right:" HorizontalAlignment="Left" TextAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IR"/>
                    </Grid>

                    <!-- Separator -->
                    <ribbon:RibbonSeparator Grid.RowSpan="3" Grid.Column="1" Margin="1,5,5,0" Style="{StaticResource RibbonSeparatorStyleKey}"/>

                <!-- Spacing -->
                    <TextBlock Grid.Row="0" Grid.Column="2" Text="Spacing" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="2" Name="BeforeSpacingGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="40"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>                                            
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="Before:" TextAlignment="Left" HorizontalAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="SB"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="2" Name="AfterSpacingGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="40"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="After:" TextAlignment="Left" HorizontalAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="SA"/>
                    </Grid>
                </Grid>
            </DataTemplate>                            
        </ribbon:RibbonGroupTemplateSizeDefinition>
        <ribbon:RibbonGroupTemplateSizeDefinition>                            
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <!-- Indent -->
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Indent" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\DecreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IL"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\IncreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IR"/>
                    </Grid>

                    <!-- Separator-->
                    <ribbon:RibbonSeparator Grid.RowSpan="3" Grid.Column="1" Margin="1,5,5,0" Style="{StaticResource RibbonSeparatorStyleKey}"/>

                    <!-- Spacing-->
                    <TextBlock Grid.Row="0" Grid.Column="2" Text="Spacing" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2" KeyTip="SB"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2" KeyTip="SA"/>
                    </Grid>
                </Grid>
            </DataTemplate>                            
        </ribbon:RibbonGroupTemplateSizeDefinition>
        <ribbon:RibbonGroupTemplateSizeDefinition IsCollapsed="True"/>
    </ribbon:RibbonGroup.GroupSizeDefinitions>
</ribbon:RibbonGroup>

It's just a TextBlock.

That appears to be directly from the WPF Source and Samples.

You'll find the following in UserControlWord.xaml which I think is the exact code that produces the entire Paragraph RibbonGroup in your Better: example. For non generic RibbonButtons and such... they usually just make their own grid of normal controls in the examples.

<ribbon:RibbonGroup Header="Paragraph" KeyTip="ZG">
    <ribbon:RibbonGroup.Resources>
        <!-- Vertical Separator-->                        
        <Style TargetType="{x:Type ribbon:RibbonSeparator}" x:Key="RibbonSeparatorStyleKey">
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <RotateTransform Angle="90"/>                                                                            
                </Setter.Value>
            </Setter>
        </Style>

        <!-- Image -->
        <Style TargetType="{x:Type Image}" x:Key="ImageStyle16Key">
            <Setter Property="Width" Value="16"/>
            <Setter Property="Height" Value="16"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor"/>
        </Style>                                                         
    </ribbon:RibbonGroup.Resources>
    <ribbon:RibbonGroup.GroupSizeDefinitions>
        <ribbon:RibbonGroupTemplateSizeDefinition>                            
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <!-- Indent -->
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Indent" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="0" Name="LeftIndentGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="35"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\DecreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="Left:" HorizontalAlignment="Left" TextAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IL"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="0" Name="RightIndentGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="35"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\IncreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="Right:" HorizontalAlignment="Left" TextAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IR"/>
                    </Grid>

                    <!-- Separator -->
                    <ribbon:RibbonSeparator Grid.RowSpan="3" Grid.Column="1" Margin="1,5,5,0" Style="{StaticResource RibbonSeparatorStyleKey}"/>

                <!-- Spacing -->
                    <TextBlock Grid.Row="0" Grid.Column="2" Text="Spacing" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="2" Name="BeforeSpacingGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="40"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>                                            
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="Before:" TextAlignment="Left" HorizontalAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="SB"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="2" Name="AfterSpacingGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="40"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <TextBlock Grid.Column="1" Text="After:" TextAlignment="Left" HorizontalAlignment="Left" Margin="3,0,0,0"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="SA"/>
                    </Grid>
                </Grid>
            </DataTemplate>                            
        </ribbon:RibbonGroupTemplateSizeDefinition>
        <ribbon:RibbonGroupTemplateSizeDefinition>                            
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <!-- Indent -->
                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Indent" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\DecreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IL"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\IncreaseIndent_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2"  KeyTip="IR"/>
                    </Grid>

                    <!-- Separator-->
                    <ribbon:RibbonSeparator Grid.RowSpan="3" Grid.Column="1" Margin="1,5,5,0" Style="{StaticResource RibbonSeparatorStyleKey}"/>

                    <!-- Spacing-->
                    <TextBlock Grid.Row="0" Grid.Column="2" Text="Spacing" HorizontalAlignment="Left"/>
                    <Grid Grid.Row="1" Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2" KeyTip="SB"/>
                    </Grid>
                    <Grid Grid.Row="2" Grid.Column="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" Source="Images\LineSpacing_16X16.png" Style="{StaticResource ImageStyle16Key}"/>
                        <ribbon:RibbonTextBox Grid.Column="2" KeyTip="SA"/>
                    </Grid>
                </Grid>
            </DataTemplate>                            
        </ribbon:RibbonGroupTemplateSizeDefinition>
        <ribbon:RibbonGroupTemplateSizeDefinition IsCollapsed="True"/>
    </ribbon:RibbonGroup.GroupSizeDefinitions>
</ribbon:RibbonGroup>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文