■ ComboBoxEdit 엘리먼트 : ItemTemplate 속성을 사용해 리스트 내에서 포함된 항목을 정의하는 DataTemplate 설정하기

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

<Grid

    xmlns:sys="clr-namespace:System;assembly=mscorlib"

    xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors">

    <dxe:ComboBoxEdit

        Width="150"

        Height="25"

        ApplyItemTemplateToSelectedItem="True"

        IsTextEditable="False"

        Text="(None)">

        <dxe:ComboBoxEdit.ItemTemplate>

            <DataTemplate>

                <Border Background="Transparent">

                    <StackPanel Orientation="Horizontal">

                        <Rectangle

                            Margin="6 0 6 0"

                            Width="10"

                            Height="10"

                            RadiusX="2"

                            RadiusY="2"

                            Fill="{Binding}" />

                        <TextBlock Text="{Binding}" />

                    </StackPanel>

                </Border>

            </DataTemplate>

        </dxe:ComboBoxEdit.ItemTemplate>

        <dxe:ComboBoxEdit.Items>

            <sys:String>Red</sys:String>

            <sys:String>Green</sys:String>

            <sys:String>Blue</sys:String>

        <dxe:ComboBoxEdit.Items>

    </dxe:ComboBoxEdit>

</Grid>

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

Posted by 사용자 icodebroker

댓글을 달아 주세요