상세 컨텐츠

본문 제목

[WPF] XML Binding

WPF

by happynuri 2008. 2. 26. 14:21

본문

<Window x:Class="Binding.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <DockPanel>
        <StackPanel Height="187" Width="265">
                <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" Text="Colors:" TextWrapping="Wrap" />
            <TextBlock Width="248" Height="24"
Text="{Binding ElementName=lbColor, Path=SelectedItem.Content,
    Mode=OneWay}"
x:Name="tbSelectedColor"
Background="{Binding ElementName=lbColor, Path=SelectedItem.Content,
    Mode=OneWay}"/>

            </StackPanel>
        </DockPanel>      
    </Grid>
</Window>

관련글 더보기

댓글 영역