첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ ListBox 엘리먼트 : SelectionMode 속성 사용하기

------------------------------------------------------------------------------------------------------------------------


TestProject.zip


MainWindow.xaml

 

 

<Window x:Class="TestProject.MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Width="800"

    Height="600"

    Title="ListBox 엘리먼트 : SelectionMode 속성 사용하기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Grid

            HorizontalAlignment="Center"

            VerticalAlignment="Center">

            <Grid.RowDefinitions>

                <RowDefinition Height="Auto" />

                <RowDefinition Height="Auto" />

            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width="Auto" />

                <ColumnDefinition Width="Auto" />

            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0"

                Margin="10">

                <Bold>SelectionMode : Single</Bold>

            </TextBlock>

            <ListBox Grid.Row="1" Grid.Column="0"

                Margin="10"

                Width="200"

                Height="300"

                SelectionMode="Single">

                <ListBoxItem>항목01</ListBoxItem>

                <ListBoxItem>항목02</ListBoxItem>

                <ListBoxItem>항목03</ListBoxItem>

                <ListBoxItem>항목04</ListBoxItem>

                <ListBoxItem>항목05</ListBoxItem>

                <ListBoxItem>항목06</ListBoxItem>

                <ListBoxItem>항목07</ListBoxItem>

                <ListBoxItem>항목08</ListBoxItem>

                <ListBoxItem>항목09</ListBoxItem>

                <ListBoxItem>항목10</ListBoxItem>

            </ListBox>

            <TextBlock Grid.Row="0" Grid.Column="1"

                Margin="10">

                <Bold>SelectionMode : Multiple</Bold>

            </TextBlock>

            <ListBox Grid.Row="1" Grid.Column="1"

                Margin="10"

                Width="200"

                Height="300"

                SelectionMode="Multiple">

                <DockPanel>

                    <Image Source="IMAGE/cat.png"/>

                    <TextBlock

                        Margin="10 0 0 0"

                        VerticalAlignment="Center">

                        CAT

                    </TextBlock>

                </DockPanel>

                <DockPanel>

                    <Image Source="IMAGE/dog.png"/>

                    <TextBlock

                        Margin="10 0 0 0"

                        VerticalAlignment="Center">

                        DOG

                    </TextBlock>

                </DockPanel>

                <DockPanel>

                    <Image Source="IMAGE/fish.png"/>

                    <TextBlock

                        Margin="10 0 0 0"

                        VerticalAlignment="Center">

                        FISH

                    </TextBlock>

                </DockPanel>

            </ListBox>

        </Grid>

    </Grid>

</Window>

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요