dotnet / dotnet/wpf

TargetNullValue causes null value in Slider Controls

Open
#11,400 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

I am using a slider, bound to a nullable decimal in a view model. It's a percentage value from 0 to 100 in with 0.1 accuarcy. I defined a TargetNullValue at 50. If I click on the slider to move it a slinge step (IsMoveToPointEnabled="False") and I reach the TargetNullValue, the value get set to null.

### Reproduction Steps

1. Create a new empty WPF Project
2. Add a slider bound to a nullable decimal in a view model
3. Define a TargetNullValue for the bound value
4. Set Min to 0 and max to 100
5. Click as long as needed to move the slider to the target null value

### Expected behavior

The value gets set and is not null. If I moved the slider before (Sliding aroung), it works as expected.

### Actual behavior

The bound value is set to null.

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

.NET Framework 4.8 on Windows 11 x64

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.