问题描述
第一个代码,效果正确。第二个代码,效果没有出来。为什么?代码一:<Windowx:Class="Test.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow"><Window.Resources><StyleTargetType="{x:TypeToolTip}"><SetterProperty="Foreground"Value="Red"></Setter></Style></Window.Resources><Grid><ButtonToolTip="按钮"Height="60"Width="60"ToolTipService.ShowDuration="10000"></Button></Grid></Window>
代码二:<Windowx:Class="Test.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow"><Window.Resources><StyleTargetType="{x:TypeToolTip}"><SetterProperty="Foreground"Value="Red"></Setter><SetterProperty="ToolTipService.ShowDuration"Value="10000"></Setter></Style></Window.Resources><Grid><ButtonToolTip="按钮"Height="60"Width="60"></Button></Grid></Window>
解决方案
解决方案二:
想知道“为什么”?问题出在哪里了?为什么setter调节器,不能调节ToolTipService.ShowDuration这个属性?
解决方案三:
注意:代码二是能编译、运行都通过的。
解决方案四:
该回复于2012-03-26 08:51:43被版主删除