Why it shows different result with the same codes?


i made simple codes follows:

 

1    using system;  2    using system.collections.generic;  3    using system.linq;  4    using system.net;  5    using system.windows;  6    using system.windows.controls;  7    using system.windows.documents;  8    using system.windows.input;  9    using system.windows.media;  10   using system.windows.media.animation;  11   using system.windows.shapes;  12     13   namespace sl4textboxbinding  14   {  15       public partial class mainpage : usercontrol  16       {  17           entitya theentity;  18     19           public mainpage()  20           {  21               initializecomponent();  22               //txtinput.lostfocus += new eventhandler(txtinput_lostfocus);  23               this.theentity = new entitya()  24               {  25                   = "the value"  26               };  27               this.datacontext = this.theentity;  28     29           }  30     31           private void txtinput_lostfocus(object sender, routedeventargs e)  32           {  33               this.txtoutput.text = this.theentity.a;  34           }  35     36     37     38       }  39   }  40     41   public class entitya : system.componentmodel.inotifypropertychanged  42   {  43       private string afield;  44         45       public string  46       {  47           get  48           {  49               return this.afield;  50           }  51           set  52           {  53               this.afield = value;  54               this.notifypropertychanged("a");  55           }  56       }  57       public event system.componentmodel.propertychangedeventhandler propertychanged;  58     59       protected void notifypropertychanged(string propertyname)  60       {  61           if (this.propertychanged != null)  62           {  63               this.propertychanged(this, new system.componentmodel.propertychangedeventargs(propertyname));  64           }  65       }  66   }  67     

 

1    <usercontrol x:class="sl4textboxbinding.mainpage"  2        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  3        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  4        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  5        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  6        mc:ignorable="d"  7        d:designheight="300" d:designwidth="400">  8      9        <grid x:name="layoutroot" background="white">  10           <textbox x:name="txtinput" text="{binding a,mode=twoway}" height="55" horizontalalignment="left"  margin="72,76,0,0" verticalalignment="top" width="248"  lostfocus="txtinput_lostfocus" />  11           <textbox x:name="txtoutput" height="55" horizontalalignment="left" margin="72,168,0,0"  verticalalignment="top" width="248" />  12       </grid>  13   </usercontrol>  14     

 

i run codes in silverlight 3 , silverlight 4. result different.

in silverlight 3,  txtoutput.text changed when change txtinput.text. txtoutput.text won't changed in silverlight 4.

 could please tell me why?

 

thanks.

hi,

through debugging, find setter of “a” property called before lostfocus event in visual studio 2008 after user updates txtinput , moves mouse txtoutput. , order reversed in visual studio 2010. reporting issue, send email production team have check.



Silverlight  >  Silverlight Controls and Silverlight Toolkit



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........