Ribbon使用笔记

1. 定义按钮组中各按钮大小
				<ribbon:RibbonGroup Header="大小" >
					<ribbon:RibbonGroup.GroupSizeDefinitions>
					<ribbon:RibbonGroupSizeDefinition>
						<ribbon:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" />
						<ribbon:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" />
						<ribbon:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" />
						<ribbon:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True" />
					</ribbon:RibbonGroupSizeDefinition>
						</ribbon:RibbonGroup.GroupSizeDefinitions>
							<ribbon:RibbonButton Height="32" x:Name="ZoomIn" DataContext="{x:Static local:BocodeEditor.ZoomIn}" />
					<ribbon:RibbonButton  Height="32" x:Name="ZoomOut" DataContext="{x:Static local:BocodeEditor.ZoomOut}" />
					<ribbon:RibbonSeparator />
					<ribbon:RibbonButton Height="32" x:Name="FitWidth"  DataContext="{x:Static local:BocodeEditor.FitWidth}"/>
					<ribbon:RibbonButton Height="32" x:Name="FitHeight" DataContext="{x:Static local:BocodeEditor.FitHeight}" />
				</ribbon:RibbonGroup>

通过使用
ribbon:RibbonControlSizeDefinition 逐个定义各按钮的样式即可

2. 下拉菜单工按钮

<ribbon:RibbonMenuButton Label="对齐" HorizontalAlignment="Left" SmallImageSource="Images/SmallIcon.png" LargeImageSource="Images/LargeIcon.png">
						<ribbon:RibbonGallery HorizontalAlignment="Left" SelectedValue="{x:Static local:BocodeEditor.FlushLeft}" ScrollViewer.VerticalScrollBarVisibility="Hidden">
						<ribbon:RibbonGalleryCategory>
								<ribbon:RibbonGalleryItem x:Name="FlushLeft">
									<ribbon:RibbonGalleryItem.Template>
										<ControlTemplate>
											<ribbon:RibbonButton DataContext="{x:Static local:BocodeEditor.FlushLeft}" />
										</ControlTemplate>
									</ribbon:RibbonGalleryItem.Template>
								</ribbon:RibbonGalleryItem>
								<ribbon:RibbonGalleryItem>
									<ribbon:RibbonGalleryItem.Template>
										<ControlTemplate>
											<ribbon:RibbonButton x:Name="FlushRight"  DataContext="{x:Static local:BocodeEditor.FlushRight}" />
										</ControlTemplate>
									</ribbon:RibbonGalleryItem.Template>
								</ribbon:RibbonGalleryItem>
								<ribbon:RibbonGalleryItem x:Name="FlushTop" >
									<ribbon:RibbonGalleryItem.Template>
										<ControlTemplate>
											<ribbon:RibbonButton DataContext="{x:Static local:BocodeEditor.FlushTop}"/>
										</ControlTemplate>
									</ribbon:RibbonGalleryItem.Template>
								</ribbon:RibbonGalleryItem>
								<ribbon:RibbonGalleryItem x:Name="FlushButtom" >
									<ribbon:RibbonGalleryItem.Template>
										<ControlTemplate>
											<ribbon:RibbonButton  DataContext="{x:Static local:BocodeEditor.FlushButtom}"/>
										</ControlTemplate>
									</ribbon:RibbonGalleryItem.Template>
								</ribbon:RibbonGalleryItem>
							</ribbon:RibbonGalleryCategory>
						</ribbon:RibbonGallery>
					</ribbon:RibbonMenuButton  >
				</ribbon:RibbonGroup>
默认样式里下拉列表里会有滚动条,通过设置

ScrollViewer.VerticalScrollBarVisibility="Hidden"

属性可以 隐藏掉

你可能感兴趣的:(header)