3
votes

I'm using a thumb control to act as a sizing control. When I move over the thumb I set the cursor to SizeWE. However, when I press the mouse to initiate the drag operation. The cursor goes back to a pointer.

I've tried setting the cursor explictly during the drag but that does not work. Thoughts?

<Style x:Key="HorizontalSizeThumbStyle" TargetType="{x:Type Thumb}">
<Setter Property="Template">
  <Setter.Value>
    <ControlTemplate TargetType="{x:Type Thumb}">
      <Rectangle Name="thumb" Width="1" Stroke="{StaticResource AppBackgroundBrush}" StrokeThickness="0.5" Cursor="SizeWE">
        <Rectangle.Fill>
          <SolidColorBrush Color="{StaticResource AppBackgroundColor}" />
        </Rectangle.Fill>
      </Rectangle>
      <ControlTemplate.Triggers>
        <Trigger Property="IsDragging" Value="True">
          <Setter TargetName="thumb" Property="Stroke" Value="{StaticResource PressedBrush}" />
          <Setter TargetName="thumb" Property="Cursor" Value="SizeWE" />
        </Trigger>
      </ControlTemplate.Triggers>
    </ControlTemplate>
  </Setter.Value>
</Setter>
</Style>
1

1 Answers

2
votes

Remove the TargetName from the IsDragging handler:

<Setter Property="Cursor" Value="SizeWE" />

instead of:

<Setter TargetName="thumb" Property="Cursor" Value="SizeWE" />