HasErrors checkbox in DataForm

Dec 26, 2011 at 5:40 PM

Hello Tony!

When I try to use your toolkit with DataForm I have an unnecessary HasErrors checkbox on it. What am I doing wrong?

This is model (fragment):

   public class Customer : ModelBase<Customer>, IEditableObject
        private string _id;
        [Display(AutoGenerateField = false)]
        public string Id
            get { return _id; }
                _id = value;
                NotifyPropertyChanged(m => m.Id);

        private string _code;
        public string Code
            get { return _code; }
                _code = value;
                NotifyPropertyChanged(m => m.Code);

 and this is xaml

<UserControl x:Class="mms.MainPage"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">

    <Grid x:Name="LayoutRoot" Background="White">
        <toolkit:DataForm Height="214" HorizontalAlignment="Left" Margin="51,52,0,0" Name="dataForm1" VerticalAlignment="Top" Width="306"
                          AutoGenerateFields="True" AutoCommit="False" Header="Head" AutoEdit="False"/>

and finally ctor

        public MainPage()

            var customers=new ObservableCollection<Customer>();
            customers.Add(new Customer { Code = "1", Id = Guid.NewGuid().ToString(), Name = "Some name" });
            dataForm1.ItemsSource = customers;

Thanks in advance for your answer


Dec 29, 2011 at 1:33 AM

Hi gem,

The HasError is a public property in ModelBase, that you have derived your model from. You can probably go into your designer and delete the checkbox if you don't need it. This property checks where the model has any errors during validation.

Hope this helps.