ToolTips with StringFormat when it’s don’t work
If you want bind a tooltip with value and have a StringFormat of a slider for exemple… the StringFormat is not apply (for tag or another property it’s the same behavior)
For solve it use this code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<Slider x:Name="slider" HorizontalAlignment="Left" Background="LightCoral" Height="29" Margin="37,162,0,0" TickFrequency="1" Tag="{Binding Value, RelativeSource={RelativeSource Self}, StringFormat=N2}" VerticalAlignment="Top" Value="0" Width="350"> <Slider.ToolTip> <ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> <TextBlock Text="{Binding Value, StringFormat=N2}" /> </ToolTip> </Slider.ToolTip> </Slider> |
tag is set for see result
Categories: Non classé
Commentaires récents