2017-12-12 57 views
1

ボタンがあり、このボタンの静的リソース(CreateNewItemButtonStyleここ)にスタイルを設定している状況です。 私もツールチップを持っており、このツールチップ上にマウスを置くとテキストが表示されます(ここでは "SelectAllLines")。 コンテンツエリアを除いたボタン領域にカーソルを合わせるとツールチップのテキストが正しく表示されます(内容 "AL"にカーソルを合わせると、ツールチップに "AL"が表示されているはずです。 のみ表示されます)ボタンエリアのツールチップ全体で「すべてのラインを選択」)。ボタンの内容にカーソルを置いたときのヒントを示すヒント

私は使用しているスタイルのためだと分かりました。

しかし、どのように私はここでツールヒント=「選択した行」

<Button 
    x:Name="AllLinesButtonX" 
    Background="{StaticResource FlowPowderBlackBrush}" 
    Click="AllLinesButtonX_OnClick" 
    Command="{Binding AllLinesCommand}" 
    Content="AL" 
    MouseRightButtonUp="SelectGeometryToggleButton_OnMouseRightButtonUp" 
    Style="{StaticResource CreateNewItemButtonStyle}" //If i remove this line it stops showing "AL", just shows "SelectedAllLines" which is the correct behavior 
    ToolTip="SelectAllLines" 
</Button> 

を行うことによって設定されている私の全体のボタン領域の上に私のツールチップに同じテキストを持っているスタイルの鍵です:

<Style x:Key="CreateNewItemButtonStyle" TargetType="Button"> 
<Setter Property="OverridesDefaultStyle" Value="True" /> 
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}" /> 
<Setter Property="BorderThickness" Value="1" /> 
<Setter Property="TextBlock.FontSize" Value="10" /> 
<Setter Property="HorizontalAlignment" Value="Center" /> 
<Setter Property="VerticalAlignment" Value="Center" /> 
<Setter Property="Cursor" Value="Hand" /> 
<Setter Property="Template"> 
    <Setter.Value> 
     <ControlTemplate TargetType="Button"> 
      <Border 
       Background="{TemplateBinding Background}" 
       BorderBrush="{TemplateBinding BorderBrush}" 
       BorderThickness="{TemplateBinding BorderThickness}" 
       SnapsToDevicePixels="True"> 
       <ContentPresenter 
        HorizontalAlignment="Center" 
        VerticalAlignment="Center" 
        Content="{TemplateBinding Content}" 
        TextBlock.TextAlignment="Center" /> 
      </Border> 
     </ControlTemplate> 
    </Setter.Value> 
</Setter> 
<Style.Triggers> 
    <Trigger Property="IsMouseOver" Value="True"> 
     <Setter Property="Background" Value="{StaticResource ActiveButtonBrush}" /> 
     <Setter Property="BorderBrush" Value="{StaticResource ActiveBorderBrush}" /> 
    </Trigger> 
    <Trigger Property="IsPressed" Value="True"> 
     <Setter Property="Background" Value="{StaticResource ActiveButtonBrush}" /> 
     <Setter Property="BorderBrush" Value="{StaticResource ActiveBorderBrush}" /> 
    </Trigger> 
    <Trigger Property="IsEnabled" Value="False"> 
     <Setter Property="Cursor" Value="Arrow" /> 
    </Trigger> 
</Style.Triggers> 

+0

.. –

答えて

関連する問題