如何将数据模板用于infragistics组合框? 基本上我们想在组合框中显示多个列。这些列来自同一对象的不同属性。
答案 0 :(得分:0)
以下是您的问题的示例。
<igDP:Field Name="MultumRoute" Label="Route" >
<igDP:Field.Settings>
<igDP:FieldSettings EditAsType="{x:Type Domain:MultumRoute}" EditorType="{x:Type igDE:XamComboEditor}" >
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igDE:XamComboEditor}">
<Setter Property="DisplayMemberPath" Value="Name" />
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource multumRouteDropDownDataSource}, Mode=OneWay}" />
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
答案 1 :(得分:0)
List<CodeItem> codes = new List<CodeItem>()
{
new CodeItem() { Code="AAA", Description="Alpha" },
new CodeItem() { Code="BBB", Description="Bravo" },
new CodeItem() { Code="CCC", Description="Charlie" },
new CodeItem() { Code="DDD", Description="Delta" },
new CodeItem() { Code="EEE", Description="Echo" },
};
comboBox1.ItemsSource = codes;
<igEditors:XamComboEditor IsEditable="False" Name="comboBox1" Height="23" Width="150">
<igEditors:XamComboEditor.PreDropDownAreaTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Code" FontWeight="Bold" Width="50" />
<TextBlock Text="Description" FontWeight="Bold" Width="100" />
</StackPanel>
</DataTemplate>
</igEditors:XamComboEditor.PreDropDownAreaTemplate>
<igEditors:XamComboEditor.ComboBoxStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Code}" Width="50" />
<TextBlock Text="{Binding Description}" Width="100" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</igEditors:XamComboEditor.ComboBoxStyle>
</igEditors:XamComboEditor>