2010-01-21 67 views
1

是否可以声明一个样式,将工具提示的字体大小设置为与父窗体相同的大小?我已经尝试过这...数据绑定在父窗口上的属性风格

<Style TargetType="{x:Type ToolTip}"> 
     <Setter Property="FontSize" Value="{Binding ElementName=MainWindow, Path=FontSize}"/> 
    </Style> 

...但这并不奏效。有什么建议么?

回答

3

我找到了我的问题的解决方案。

<Style TargetType="{x:Type ToolTip}"> 
     <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=FontSize}"/> 
    </Style> 
相关问题