Change default cursor for NumericUpDown inherited control? #18009
Unanswered
MechWarrior99
asked this question in
Q&A
Replies: 1 comment
-
It is that Style directly on the ScrollViewer inside the TextBox that is preventing overruling the cursor probably. Don't know how to overrule it, maybe someone else knows. But instead you could also try to set Cursor of its inner TextPresenter (and the watermark textblock): <ControlTheme
x:Key="NumericUpDownTextBox"
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox">
<Style Selector="^ /template/ TextPresenter#PART_TextPresenter">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Cursor" Value="SizeNorthSouth" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type views:DraggableNumericUpDown}"
TargetType="views:DraggableNumericUpDown"
BasedOn="{StaticResource {x:Type NumericUpDown}}">
<Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="Theme" Value="{StaticResource NumericUpDownTextBox}" />
</Style>
</ControlTheme> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a class that inherits from
NumericUpDown
, which extact the same, except a drag can be started over it to increase/decrease the value. TheNumericUpDown
is focused on PointerReleased if the pointer didn't move (with a margin of error) from thePointerPressed
.This is all to say that I want to replace the default
IBeam
cursor when the pointer is over the control with aSizeNorthSouth
cursor.This is the control theme for it that I have now.
This is an example of the best I could get, but as you can see it is still going to the
IBeam
.AvaloniaApplication1.Desktop_2025-01-20_16-55-55.mp4
I've tried debugging but no luck.
This is the NumericUpDown.xaml, and this is the TextBox.xaml where I am trying to set the Cursor.
Any suggestions would be great!
Beta Was this translation helpful? Give feedback.
All reactions