http://msdn.microsoft.com/en-us/magazine/cc163299.aspx

 

<StackPanel>
    <TextBlock Width="248" Height="24" Text="Colors:" 
        TextWrapping
="Wrap"/>
    <ListBox x:Name="lbColor" Width="248" Height="56">
        <ListBoxItem Content="Blue"/>
        <ListBoxItem Content="Green"/>
        <ListBoxItem Content="Yellow"/>
        <ListBoxItem Content="Red"/>
        <ListBoxItem Content="Purple"/>
        <ListBoxItem Content="Orange"/>
    </ListBox>
    <TextBlock Width="248" Height="24" Text="You selected color:" />
    <TextBlock Width="248" Height="24">
        <TextBlock.Text>
            <Binding ElementName="lbColor" Path="SelectedItem.Content"/>
        </TextBlock.Text>
    </TextBlock>

</StackPanel> 

posted on 2012-03-16 01:18  微星  阅读(127)  评论(0编辑  收藏  举报