0
我遇到一個XamDataGrid在其中一個字段中承載XamComboBox問題。如果用戶使用鼠標將焦點置於組合框列中,然後使用鍵盤上的字母選擇項目,然後按Tab鍵移至下一列,則組合中的選擇將丟失。XamDataGrid與XamComboEditor不保留選擇
我不確定這是控件中的錯誤還是隻是我使用它們的方式,我試圖通過使用CellDeactivating事件來解決問題,但我認爲該值已經失去了那一點。我正在使用控件的版本11.2.20112.2316。 我也發佈了這個到Infragistics forums。
這一點XAML和代碼隱藏證明了這個問題。
<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; }
}
}