Hello,
when I bind a field to a custom object which implements ToString() it will be displayed like expected.I set a combobox with a collection of these custom objects as editor for the field by using a style.Unfortunately as soon as I use a custom object instead for example a simple string,the field gets read-only and the selection combobox is never displayed.
How can I get an editable field for custom-object (selection) on the XamDataGrid?
Thanks a lot.
Hello Josef,
Thank you for your post.
I was researching your question and it seems that the reason for the reported behavior , is because you had not set the EditorType property of FieldSettings to XamComboEditor. I created a sample application(CustomObjectComboBox.zip), that shows you how you can implement this approach.
Please let me know if you need any further assistance on this matter.
Hello Zhivko,
I should have written that I need to define the combobox editor using a Style.Found this in other forum posts. The reason is that I need the advanced filtering support within the combobox.
See the following code snippet.Thank you.
<!-- User selection --> <local:UserDataSelectionConverter x:Key="UserIdToUserDisplayConverter" /> <Style TargetType="{x:Type igEditors:XamTextEditor}" x:Key="UserSelectionStyle"> <Setter Property="EditTemplate"> <Setter.Value> <ControlTemplate> <ig:XamComboEditor ItemsSource="{Binding DataContext.Users, Source={StaticResource DataContextProxy}}" DisplayMemberPath="DisplayText" AllowFiltering="True" AllowMultipleSelection="False" OpenDropDownOnTyping="True" DropDownButtonDisplayMode="Always" SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value, Mode=TwoWay, Converter={StaticResource UserIdToUserDisplayConverter}, ConverterParameter={StaticResource DataContextProxy} }" > <ig:XamComboEditor.ItemFilters> <ig:ComboItemFilter FieldName="FilterText"> <ig:ComparisonCondition Operator="Contains" /> </ig:ComboItemFilter> </ig:XamComboEditor.ItemFilters> </ig:XamComboEditor> </ControlTemplate> </Setter.Value> </Setter> </Style> <!-- Mitarbeiter --> <igDP:Field Name="UserDisplayName" Label="Mitarbeiter" Width="90"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource UserSelectionStyle}" AllowRecordFiltering="True" /> </igDP:Field.Settings> </igDP:Field>
I forgot to mention why I set the combobox using a style instead of setting the EditorType of the field.
When I set the EditorType, the control will use the Infragistics.Windows.Editors.XamComboEditor for the cell.But I need the shared one from Infragistics.Controls.Editor.XamComboEditor which is much more feature rich.Here is the problem that the shared combobox does not derive from ValueEditor and is not usable directly.
As I wrote, I need the advanced filtering of the shared combobox.So, how can I combine both needs together?
Thank you very much.
I changed my strategy to use the supported WPF ComboEditor instead of the shared one.The needed filtering capabilities I've added using a subclass FilteringXamComboEditor.Please try this out in the attached sample.
I have the following issue with this:When you type some filtering characters in the dropdown (the typed chars will be invisible, try "ste" for example),the list will be filtered. But most time it looses selection focus so you can only select an item by mouse, not by up/down keys any more.
How can I set the selection focus after applying a filter to the items source?
Thank you for help!
Hello Josef.
I was researched your issue and I modified your sample to implement the filtering in the XamComboEditor. Since all XamComboEditors are sharing an ItemsSource, modifying and clearing it to implement the filtering might cause issues, i created different approach for you, to implement the filtering. I have created a style for the ComboBoxItem and used a MultiBinding to bind the visibility property for the and also the FilterText property of ComboBox with the item property of ComboBoxItem. .By doing so, when typing and the FilterText is changed, the items of the drop down that does not much the search criteria are collapsed and cannot be selected.