MyWindow.xaml
SliderのValueをTextBoxのテキストにバインドする。
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow"> <StackPanel> <TextBox Name="textBox" Width="100" Text="{Binding ElementName=slider, Path=Value}"></TextBox> <Slider Name="slider" /> </StackPanel> </Window>
MyWindow.xaml.cs
using System.Windows; namespace WpfApplication1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } } }