Title: Why is WPF slider value not precise
Tags: slider;wpf-controls
Question: I have a slider in wpf

```<Slider x:Name="slider" Maximum="8" Minimum="1" VerticalAlignment="Center" TickFrequency=".1" IsSnapToTickEnabled="True" TickPlacement="TopLeft" SmallChange="0.1" /&gt;
```

To its ```value``` I have bounded a label

```<Label Content="{Binding Value, ElementName=slider}"/&gt;
```

As I set the focus on the slider and move to right, or drag the thumb with mouse, the value gets raised by 0.1 as expected, but sometimes it shows this kind of value ```1.7000000002```

Does anybody know how to fix this to show just the values like 1.1, 1.2 etc? Thanks



Here is another answer: Why don't you use a TextBlock instead of Label?

```<TextBlock Text="{Binding Value, ElementName=slider}"/&gt;```

display the slider's value exactly as you want.

Comment for this answer: dont know why should I, is there any difference? but I may try that, if that should solve my problem

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:07/15/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<slider><wpf-controls>', 'Title': 'Why is WPF slider value not precise', 'ViewCount': 162, 'id': 17662234, 'user_AboutMe': '<p>n/a</p>\n', 'user_AccountId': 182955.0, 'user_DisplayName': 'Zavael', 'user_Reputation': 2231.0, 'user_Views': 215.0, 'user_id': 418031.0}}