Hello,
I'm having problems using the xamComboEditor when items in the itemsSource have a DataTemplate for their Type. When Binding the xamCombo the list of Items is correctly rendered according to each Items DataTemplate.
However when the xamCombo loses focus then the text for the SelectedItem is refreshed and overwritten with the ToString of the SelectedItem object. With a normal WPF combobox there is no change when the control loses focus . How can I get the same behavior as a normal combobox. Below is a simple piece of code to reproduce the problem. Thanks, Christian
The XAML:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igRibbon="http://infragistics.com/Ribbon"
xmlns:local="clr-namespace:Ribbontest"
xmlns:s="clr-namespace:System;assembly=mscorlib"
x:Class="Ribbontest.Window12"
Title="Window12" Height="300" Width="300" xmlns:igWindows="http://infragistics.com/Windows">
<Window.Resources>
<local:ProductConverter x:Key="ProductConverter" />
<DataTemplate DataType="{x:Type local:Product}">
<TextBlock Text="xxx" />
</DataTemplate>
<ObjectDataProvider x:Key="provider"/>
</Window.Resources>
<StackPanel>
<igRibbon:ComboEditorTool
Id="productsCombo"
x:Name="productsCombo"
IsEditable="False" ItemsSource="{Binding Items}">
</igRibbon:ComboEditorTool>
<ComboBox x:Name="productsCombo2" ItemsSource="{Binding Items}"/>
<TextBox Text=" "/>
</Window>
The Code Behind:
{
/// <summary>
/// Interaction logic for Window12.xaml
/// </summary>
public partial class Window12 : Window
InitializeComponent();
Items.Add(new Product(1, "aaa"));
}
Hi,
That seems to be a bug in XamComboEditor. If you report the issue to our Developer Support group, they will be sure that you are sent a notification when the issue has been resolved. Sorry for the inconvenience.
Thanks,Josh
Any indication that this has been fixed??? - it was 12 months ago!
I've got the following:
<igEditors:XamComboEditor x:Name="cbPerson" DisplayMemberPath="Name" ValueType="{x:Type local:Person}" Value="{Binding Source={x:Static local:Window1.SelectedPerson}, Path=Name, Mode=OneWay}"> <igEditors:XamComboEditor.ItemsSource> <CompositeCollection> <CollectionContainer Collection="{Binding Source={x:Static local:Window1.StandingData}, Mode=OneWay}" /> </CompositeCollection> </igEditors:XamComboEditor.ItemsSource> </igEditors:XamComboEditor>
but when the 'Window1.SelectedPerson doesn't exist in the Window1.StandingData list it seems to be calling ToString() on the SelectedPerson object rather than using the DisplayMemberPath as indicated.
I don't really want to implement ToString on all my classes in this way.
Can you suggest a course of action?
This sounds like a different issue than the one originally discussed in this thread. For the original issue, the default render template for the xamComboEditor has a TextBlock that it binds to its DisplayText property so the data template isn't used. In 9.1, we added a DisplayValueSource property that defaults to DisplayText but can be set to Value so that the DataTemplate associated with the data type of the value could be used; in previous versions one would have to provide a custom default template for the control that used a ContentPresenter and bound to the Value property. It sounds like you are having a different issue. Do you have a sample that shows the problem you are having so we can look into it?