Hi,
i guess this is a bug report for XamDataGrid.
I successfully displayed a row error using IDataErrorInfo.Error property setting FieldLayoutSettings.SupportDataErrorInfo to "RecordsAndCells".
Also the change notification with PropertyChanged(String.Empty) works.
BUT: It only works if AutoGenerateColumns is set to true. If it is set to false, the row error is still displayed. But the XamDataGrid won't react on the property change.
This does not really make sense to me.
Regards,
Karl-Michael Beck
Hi, here's the file. :)
You can attach a sample project using the Options tab on the reply form.
Looking forward to looking into your sample project.
Hi, im sending another example where the error occurs. Is it somehow possible for me to attach a zip file anway?
Set the aShowError variable to true to see what's not working.
Set the aShowError variable to false to see what's working.
The issue is i think that i do not have a column change that makes the row error disappear.
(Sorry for the formating but the copy paste just don't work so well)
MainWindow.xaml
<Window x:Class="DataErrorInfoProblem2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:igDP="http://infragistics.com/DataPresenter"> <Grid> <StackPanel Orientation="Vertical"> <Button Click="Button_Click" >hit me</Button> <igDP:XamDataGrid HorizontalAlignment="Left" Name="xamDataGrid1" RecordContainerGenerationMode="LazyLoad" > <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings SupportDataErrorInfo="RecordsAndCells"/> </igDP:XamDataGrid.FieldLayoutSettings> </igDP:XamDataGrid> </StackPanel> </Grid> </Window>
---------------------------------------------------------------------------
MainWindow.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;
namespace DataErrorInfoProblem2 { /// <summary> /// Interaktionslogik für MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); bool aShowProblem = true; this.xamDataGrid1.FieldLayoutSettings.AutoGenerateFields = !aShowProblem; this.xamDataGrid1.DataSource = new CRecord[] { this.Record }; }
private CRecord Record = new CRecord();
private void Button_Click(object sender, RoutedEventArgs e) { if(this.Record.Error == string.Empty) { this.Record.Error = "TestError"; } else { this.Record.Error = String.Empty; } } }
public class CRecord : System.ComponentModel.IDataErrorInfo, System.ComponentModel.INotifyPropertyChanged { public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
private string ErrorM = "TestError"; public string Error { set { this.ErrorM = value; if (null != this.PropertyChanged) { this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("")); } } get { return this.ErrorM; } }
public string this[string aName] { get { return string.Empty; } } }
}
Hello Karl-Michael Beck,
I have been looking into your issue and in order to test this out I whipped up a small test sample (Grid_IDataError_row_border.zip) where everything seems to work as expected with the UnboundFields. Please look into the attachment I have created for you and let me know if there is anything I am missing, or if this solved you issue.
Looking forward to hearing from you.