<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="MainWindow" Height="200" Width="400" >
<StackPanel Margin="20">
<TextBox x:Name="TextBox1" Height="30" Margin="5" BorderBrush="Black"/>
<TextBox x:Name="TextBox2" Height="30" Margin="5" BorderBrush="Black" Text="{Binding Path=Text.[3],ElementName=TextBox1,Mode=OneWay}"/>
</StackPanel>
</Window>
知识点总结:集合类型的索引器(Indexer)又称为带参属性。既是属性,索引器也能作为Path来使用。如文中的path=Text.[3]