RibbonApplicationMenu - Label 设置不启作用

翻译 2013年12月02日 19:27:35

问题: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

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}"/>


相关文章推荐

jQuery EasyUI 1.3.6 form中的<label for="...">对于combogrid不起作用的问题修正

在此版本的easy ui中,当使用如下的代码

gtk_label的简单设置

Redhat5.7 重启后报错 "unable_to_resolve LABEL=/app"

故障描述: 昨天下午快下班时,我还在导AWR报表,突然屏幕显示 'reboot' , 当时差点晕啦,上面可是跑着ORACLE,难道导AWR完成会重启系统(事后证明不是我的问题,是同事给重启的)。 ...

Label设置行间距

Label设置行间距

20140929个人日志(label设置背景图,版本发布)

[_labelView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"description_back...

uilabel 的相关处理 类富文本(自动换行,设置行高,同一个label多种颜色,给文字加下划线 首行缩进 等 等)

1.自动换行 UIFont *font=[UIFont systemFontOfSize:lableFont]; self.numberOfLines=0; self.lineBreakMode=NS...

iOS 中Label在自适应宽高的同时设置文字行距行距

直接写一个类别:.h文件的方法接口#import @interface UILabel (Adaptive) /** * 自适应宽高同时调整行距 * * @param text label....

iOS 根据字符串设置label 的高度

NSString * str = @"我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,我是亿万富我那个,...

C# winform自定义Label控件使其能设置行距

1)在windows窗体应用程序中添加组件类代码如下 using System; using System.Collections.Generic; using System.Linq; using ...

动态计算Label的宽高+文字设置

iOS7之后苹果推荐使用boundingRectWithSize:的方法来计算文字的宽高,使用这个方法就能动态计算文字的宽高,而不用自己去预算文字需要多宽多高下面,我们就具体看看这个方法如何使用: ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)