0
votes

I'm having an issue with a XamDataGrid that is hosting a XamComboBox in one of the fields. If the user uses the mouse to put focus into the combo box column and then uses a letter on the keyboard to select an item and then presses tab to move to the next column, the selection in the combo is lost.

I'm not sure whether this is a bug in the controls or just the way I'm using them, I've tried to work round the issue by using the CellDeactivating event, but I think the value has already been lost by that point. I'm using version 11.2.20112.2316 of the controls. I've also posted this to the Infragistics forums.

This little bit of XAML and code-behind demonstrates the issue.

<Window x:Class="DataGridTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ig="http://infragistics.com/DataPresenter"
        xmlns:igEditors="http://infragistics.com/Editors"
        Title="MainWindow" Height="350" Width="525">
    <ig:XamDataGrid DataSource="{Binding MyData}" >
        <ig:XamDataGrid.FieldLayoutSettings>
            <ig:FieldLayoutSettings AllowAddNew="True" AutoGenerateFields="False" />
        </ig:XamDataGrid.FieldLayoutSettings>
        <ig:XamDataGrid.FieldLayouts>
            <ig:FieldLayout>
                <ig:Field Name="Code">
                    <ig:Field.Settings>
                        <ig:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}">
                            <ig:FieldSettings.EditorStyle>
                                <Style TargetType="{x:Type igEditors:XamComboEditor}">
                                    <Setter Property="ValuePath" Value="Code" />
                                    <Setter Property="DisplayMemberPath" Value="Description"/>
                                    <Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=MyData2}" />
                                </Style>
                            </ig:FieldSettings.EditorStyle>
                        </ig:FieldSettings>
                    </ig:Field.Settings>
                </ig:Field>
                <ig:Field Name="Description"></ig:Field>
            </ig:FieldLayout>
        </ig:XamDataGrid.FieldLayouts>
    </ig:XamDataGrid>
</Window>

-

using System;
using System.ComponentModel;
using System.Windows;

namespace DataGridTest
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            MyData = new BindingList<MyModel>
                {
                    new MyModel {Code = "T1", Description = "Test 1"},
                    new MyModel {Code = "T2", Description = "Test 2"}
                };

            MyData2 = new BindingList<MyModel>
                {
                    new MyModel {Code = "T1", Description = "Test 3"},
                    new MyModel {Code = "T2", Description = "Test 4"}
                };

            DataContext = this;
        }

        public BindingList<MyModel> MyData { get; set; }
        public BindingList<MyModel> MyData2 { get; set; }
    }

    public class MyModel
    {
        public string Code { get; set; }
        public string Description { get; set; }
    }
}
1

1 Answers

2
votes

I have been looking into this and it seems like that there is an internal issue with the XamComboEditor, XamDataGrid and selection.

Also there are more details for this in the duplicate forum thread in the Infragistics' forum here:

http://www.infragistics.com/community/forums/p/84127/420015.aspx