RibbonApplicationMenu - Label 设置不启作用
2013-12-02 19:27
411 查看
问题:I am using the WPF ribbon from October 2010, I would like to have the word "File" as the ApplicationMenu "label" similar to excel 2010. I set the Label property but it does not seem to do anything. I see there is a smallImageSource property but I jsut
want to put text.
答案:Regarding to the first question, I checked the source code of the Ribbon controls (please download theMicrosoftRibbonForWPFSourceAndSamples
from web site). In the theme file (\MicrosoftRibbonForWPFSourceAndSamples\RibbonControlsLibrary\Themes\Generic.xaml) of the ribbon
8233行附近 change the code: 最后一行添加Label={TemplateBinding Label}
8393行附近 change the code: add code Label="{TemplateBinding Label}" 最后一行
want to put text.
答案:Regarding to the first question, I checked the source code of the Ribbon controls (please download theMicrosoftRibbonForWPFSourceAndSamples
from web site). In the theme file (\MicrosoftRibbonForWPFSourceAndSamples\RibbonControlsLibrary\Themes\Generic.xaml) of the ribbon
8072行附近, change the code:
<!--<Image IsHitTestVisible="False" Source="{Binding RelativeSource ={RelativeSource FindAncestor, AncestorType ={x:Type ribbon:RibbonApplicationMenu}}, Path=SmallImageSource}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16" RenderOptions.BitmapScalingMode="NearestNeighbor" RenderOptions.EdgeMode="Aliased" />--> <TextBlock Text="{TemplateBinding Label}"/>
8233行附近 change the code: 最后一行添加Label={TemplateBinding Label}
<ControlTemplate TargetType="{x:Type ribbon:RibbonApplicationMenu}"> <Grid Focusable="False" x:Name="OuterGrid" SnapsToDevicePixels="True"> <ribbon:RibbonToggleButton x:Name="PART_ToggleButton" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" Style="{StaticResource Ü}" FocusVisualStyle="{TemplateBinding FocusVisualStyle}" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Height}" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Width}" ToolTipTitle="{TemplateBinding ToolTipTitle}" ToolTipDescription="{TemplateBinding ToolTipDescription}" ToolTipImageSource="{TemplateBinding ToolTipImageSource}" ToolTipFooterTitle="{TemplateBinding ToolTipFooterTitle}" ToolTipFooterDescription="{TemplateBinding ToolTipFooterDescription}" ToolTipFooterImageSource="{TemplateBinding ToolTipFooterImageSource}" SmallImageSource="{TemplateBinding SmallImageSource}" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen, Mode=TwoWay}" Label="{TemplateBinding Label}"/>
8393行附近 change the code: add code Label="{TemplateBinding Label}" 最后一行
<Canvas> <ribbon:RibbonToggleButton x:Name="PART_PopupToggleButton" AutomationProperties.Name="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(AutomationProperties.Name)}" Canvas.Top="-24" Canvas.Left="3" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" Style="{StaticResource Ü}" Focusable="False" Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Height}" Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Width}" Label="{TemplateBinding Label}"/>
相关文章推荐
- ajax中设置contentType: "application/json"的作用
- android:label标签在application和activity中的设置问题
- Application.DoEvents()的作用
- 应用键横竖屏切换;label中显示图片;不同类型设备适配的代码;UIWebView字体大小、字体颜色、背景色的设置;
- 在gridview里对日期字段设置dataformatstring="{0:yyyy-MM-dd}"没有任何作用的解决方法
- [置顶] RecyclerView常见问题解决方案,RecyclerView嵌套自动滚动,RecyclerView 高度设置wrap_content 无作用等问题
- 对request,session,application作用域形象理解
- 自定义背景及进度背景的progressbar进度条,可在用户设置等级等领域有所作用
- 设置一个label显示多种颜色,多种字体大小
- Application.DoEvents()的作用
- label标签for的作用
- label和span标签设置宽度width无效问题的解决方式
- LabelTTF 设置字体时的问题
- 设置Menu的颜色
- SpringCloud Config Server中{application}等占位符使用场景设置默认拉去分支
- ToolStripMenuItem 设置快捷键屏蔽了其他控件的快捷键
- 关于Xib中设置label换行,而没有实现的问题
- iOS label设置内容为HTML
- WebDynpro Application 自动登录设置
- Using commands with ApplicationBarMenuItem and ApplicationBarButton in Windows Phone 7