我希望在滑动滑块时更改 TextBox 中的文本,反之亦然(当我在 TextBox 中键入时,滑块的值会更改)。这是 Slider 的 XAML 代码:
<Slider x:Name="PercentageSlider" HorizontalAlignment="Left" Height="46" Margin="333,319,0,0" VerticalAlignment="Top" Width="788" Foreground="#FF5D9FAD" Minimum="1" Value="{Binding Text, ElementName=PercentageValueTextBox}"/>
这是文本框:
<TextBox x:Name="PercentageValueTextBox" Height="46" Margin="0,319,161,0" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Right" Width="69" FontSize="26" Foreground="White" Background="{x:Null}" Text="{Binding Value, ElementName=PercentageSlider}"/>