Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
XamComboEditor - DataTemplates and control focus
posted

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:igEditors="http://infragistics.com/Editors"

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=" "/>

</StackPanel>

</Window>

The Code Behind:

namespace Ribbontest

{

/// <summary>

/// Interaction logic for Window12.xaml

/// </summary>

public partial class Window12 : Window

{

public Window12()

{

InitializeComponent();

Items =
new ObservableCollection<object>();

Items.Add(new Product(1, "aaa"));

Items.Add(new Product(2, "bbb"));Items.Add(new Product(3, "ccc"));

 

DataContext =
this;

 

}

 

public ObservableCollection<object> Items { get; set; }

}

}