wpf - DataGridTextColumn not updating properly with ValidatesOnDataErrors = True -


i have problem wpf control datagrid , datagridtextcolumn. when binding set include validatesondataerrors = true, first input user replaced null after having been commited.

xaml:

<datagrid itemssource="{binding}" autogeneratecolumns="false">     <datagrid.columns>         <datagridtextcolumn header="description" binding="{binding description, updatesourcetrigger=propertychanged, mode=twoway, validatesondataerrors=true}"/>     </datagrid.columns> </datagrid> 

datacontext set in code-behind:

this.datacontext = new list<viewmodel>()    {         new viewmodel() { description = null },         new viewmodel() { description = "kalle" },         new viewmodel() { description = "olle" }    }; }  public class viewmodel : idataerrorinfo {     public string description { get; set; }      public string error     {         { return null; }     }      public string this[string columnname]     {                 {            if (columnname == "description" && string.isnullorempty(description))                 return "cannot null";             return null;          }     } } 

the error reproduced clicking in invalidated cell twice (important!) enter editing mode. written in cell replaced null after looses focus, pressing enter or like. written in cell after not replaced.

surely there must going on here?


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -