<ListBox x:Name="listBox" HorizontalAlignment="Left" Height="100" Margin="401,312,0,0" VerticalAlignment="Top" Width="100" >
<ListBoxItem>Line 1</ListBoxItem>
<ListBoxItem>Line 2</ListBoxItem>
</ListBox>
<TextBox x:Name="textBox" HorizontalAlignment="Left" Height="23" Margin="207,290,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120">
<TextBox.Text>
<Binding ElementName="listBox" Path="SelectedItem.Content"></Binding>
</TextBox.Text>
</TextBox>
如下圖, TextBox 裡顯示 ListBox 選的項目:
沒有留言:
張貼留言