3

我正在使用拇指控件作为尺寸控件。当我移动拇指时,我将光标设置为 SizeWE。但是,当我按下鼠标启动拖动操作时。光标回到指针。

我尝试在拖动过程中明确设置光标,但这不起作用。想法?

<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>
4

1 回答 1

2

从 IsDragging 处理程序中删除 TargetName:

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

代替:

<Setter TargetName="thumb" Property="Cursor" Value="SizeWE" />
于 2013-10-20T21:07:41.257 回答