Hi all,
Can any one help me in applying datatemplate to a comboboxdataitem when i am using XamComboEditor specific to field in a XamDataGrid and use a ListView in the datatmplate to populate the data in the ComboEditor?
For Example:
<igDP:Field Name="Column1" Label="Column1" Row="0" Column
="0">
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor
}" >
<igDP:FieldSettings.EditorStyle
>
<Style TargetType="{x:Type igEditors:XamComboEditor
}">
<Setter Property="ItemsProvider" Value="{StaticResource Column1ItemsProvider
}"/>
<Setter Property="IsEditable" Value
="True"/>
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path
=Value}"/>
</Style
</igDP:FieldSettings.EditorStyle
</igDP:FieldSettings
</igDP:Field.Settings
</igDP:Field
<igDP:Field Name="column2" Label="column2" Row="0" Column
="1">
<igDP:Field.Settings
<Setter Property="ItemsProvider" Value="{StaticResource column2ItemsProvider
Thanks
Prakash
Hello Prakash,
The way to apply a DataTemplate to a XamComboEditor item is to create a DataTemplate within the Resources section of a XamComboEditor Style. The DataTemplate can target the type of data used in your binding expression.
<Style x:Key="myComboEditorStyle" TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="DisplayValueSource" Value="SelectedItem" />
<Style.Resources> <DataTemplate DataType="{x:Type data:Item}"> <Grid> <igEditors:XamTextEditor Value="{Binding Name, Mode=TwoWay}" />
etc...
I've attached a sample illustrating how to use a DataTemplate in the XamCOmboEditor.
Someone reading this post may think, why not just use a regular ComboBox and apply a DataTemplate to that instead? Here are some thoughts from engineering on this topic:
The advantage of using the XamComboEditor is that it offers certain functionalities that ComboBox doesn’t offer – like being able to share the same items provider across multiple XamComboEditors as well as the use of multiple built-in themes. Also it offers better performance since only the editor that’s in edit mode will have hydrated its items collection. This especially helps performance in the data presenter (such as in the XamDataGrid) where you may have a lot of cells using XamComboEditor.
Another thing with using ComboBox is that it will be hard or tricky to fully integrate that inside data presenter cells since ComboBox is not a ValueEditor.
Thank you,
Hi Curtis,
I wanted to use the XamComboBox Editor Capabilities and each row should show couple of columns but more than one column.
Before I create a sample for you, I have a couple of questions. Does each row in your ComboEditor have only one record? If so, then a simple DataTemplate with basic controls would be better than using a DataGrid or ListView. Do you need the unique edit mode capability of the XamComboEditor? If not, it would be simpler to use the standard WPF ComboBox with an Items Template. Give me more details and I will post a sample that matches your requests.
Thanks!
HI Curtis,
Thanks for you reply.
My main goal was to see multiple columns in the XamComboBoxEditor.Let me know if you any simple example of doing that.
Prakash.
I apologize that this post was not answered sooner. We are making the effort to ensure all posts are addressed by an Infragistics expert. I was wondering if you still need our assistance in this matter. If so, would you be willing to submit a small sample WPF project? I would update your project with a DataTemplate that fits into the approach you are taking. DataTemplates are very specific to the data used and the XAML does not have enough information for me to effectively address this request.
Thank you very much!