可以在任何的Controls中使用,當鼠標移到控制項上就會出現提示訊息
ToolTip="你想提示的話"
比較特別的是,ToolTip不只可以放string type,而是可以放object type,
所以你可以在ToolTip做出豐富的效果
<Button>
<Button.Content>
<Image
Source="/WpfTutorialSamples;component/Images/folder.png"
Width="16" Height="16" />
</Button.Content>
<Button.ToolTip>
<StackPanel>
<TextBlock
FontWeight="Bold" FontSize="14"
Margin="0,0,0,5">Open file</TextBlock>
<TextBlock>
Search your computer or
local network
<LineBreak />
for a file and open it
for editing.
</TextBlock>
<Border
BorderBrush="Silver" BorderThickness="0,1,0,0"
Margin="0,8" />
<WrapPanel>
<Image
Source="/WpfTutorialSamples;component/Images/help.png"
Margin="0,0,5,0" />
<TextBlock FontStyle="Italic">Press
F1 for more help</TextBlock>
</WrapPanel>
</StackPanel>
</Button.ToolTip>
</Button>
ToolTip就像root
control一樣,可以讓我們在裡面加上許多的controls
其他屬性
ToolTipService.ShowDuration="5000"
- 提示出現5秒
ToolTipService.ShowOnDisabled
="True" - 被disable的control也會出現提示
text render
TextOptions. TextFormattingMode
TextOptions. TextRenderingMode
從.NET 4.0之後,developer可以自行指定想要用怎樣的模式來顯示text,使用TextOptions
沒有留言:
張貼留言