1)定义模板资源
<UserControl.Resources> <local:StatusConvertor x:Key="StatusConvertor"></local:StatusConvertor> <cvt:FullNameConverter x:Key="fullNameConverter"></cvt:FullNameConverter> <DataTemplate x:Key="doctorTemplate"> <TextBlock Text="{Binding .,Converter={StaticResource ResourceKey=fullNameConverter}}" Margin="4,0,0,0"></TextBlock> </DataTemplate> </UserControl.Resources>
2)使用模板资源
<dxe:ComboBoxEdit Name="comboBoxEdit_Doctor" ApplyItemTemplateToSelectedItem="True" ItemTemplate="{StaticResource ResourceKey=doctorTemplate}" IsTextEditable="False" ShowCustomItems="True" Margin="0,1" Width="300" HorizontalAlignment="Left" SelectedIndexChanged="comboBoxEdit_Doctor_SelectedIndexChanged" />