讓ComboBox的每一個Item前面帶一張圖

  • 777
  • 0

摘要:讓ComboBox的每一個Item前面帶一張圖


<Style TargetType="ComboBox">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <DockPanel>
                            <Image DockPanel.Dock="Left" Source="e:\temp\1.jpg" Width="16" Height="16" Stretch="UniformToFill"/>
                            <TextBlock Text="{Binding Path=TaskName}"/>
                            <TextBlock Text="{Binding Path=Description}"/>
                            <TextBlock Text="{Binding Path=Priority}"/>
                        </DockPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>