2012-07-12 3 views

답변

42

사용이 코드 :

<Window x:Class="WpfApplication2.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
    x:Name="Window" 
    Title="MainWindow" 
    Width="640" 
    Height="480"> 

<Window.Resources> 

    <Style x:Key="{x:Type ToolTip}" TargetType="ToolTip"> 
     <Setter Property="OverridesDefaultStyle" Value="true" /> 
     <Setter Property="HasDropShadow" Value="True" /> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="ToolTip"> 
        <ed:Callout Name="Border" 
           Width="{TemplateBinding Width}" 
           Height="{TemplateBinding Height}" 
           MinWidth="100" 
           MinHeight="30" 
           Margin="0,0,0,50" 
           AnchorPoint="0,1.5" 
           Background="{StaticResource LightBrush}" 
           BorderBrush="{StaticResource SolidBorderBrush}" 
           BorderThickness="1" 
           CalloutStyle="RoundedRectangle" 
           Fill="#FFF4F4F5" 
           FontSize="14.667" 
           Stroke="Black"> 
         <ContentPresenter Margin="4" 
              HorizontalAlignment="Left" 
              VerticalAlignment="Top" /> 
        </ed:Callout> 

       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 

</Window.Resources> 
<Grid> 
    <Button ToolTip="Hello" /> 
</Grid> 

이는 시작 부분입니다, 지금 당신이 그것으로 재생이 ... 재미있는 시간을 가지세요!

enter image description here

+0

해리 감사합니다. 다른 질문이 있습니다 : xmlns에 대한 어셈블리를 추가해야합니까 : ed = "http://schemas.microsoft.com/expression/2010/drawing"? –

+7

예, Microsoft.Expression.Drawing 어셈블리를 추가하십시오. – Harry

+0

굉장! 똑똑한 작품, 분명히 투표하십시오 –

0

control template이라는 새 툴팁을 만들 수 있습니다.

+0

실용 예제를 게시 할 수 있습니까? 대체 구현을 보는 것이 흥미로울 것입니다. – Tim

관련 문제