c# - Exception while setting DataContext -


i have created custom usercontrol exposes dependencyproperties headertitle , headertitleforeground

public partial class pageheadercontrol : usercontrol {     public string headertitle      {         { return (string)getvalue(headertitleproperty); }         set { setvalue(headertitleproperty, value); }     }      public static readonly dependencyproperty headertitleproperty = dependencyproperty.register("headertitle", typeof(string), typeof(pageheadercontrol), new propertymetadata(""));      public string headertitleforeground     {         { return (string)getvalue(headertitleforegroundproperty); }         set { setvalue(headertitleforegroundproperty, value); }     }      public static readonly dependencyproperty headertitleforegroundproperty = dependencyproperty.register("headertitleforeground", typeof(string), typeof(pageheadercontrol), new propertymetadata(""));      public pageheadercontrol()     {         initializecomponent();         (this.content frameworkelement).datacontext = this;     } } 

but while debugging app throws exception show below:

  system.exception occurred    _hresult=-2146233088    _message=error hresult e_fail has been returned call com component.    hresult=-2146233088    message=error hresult e_fail has been returned call com component.    source=system.windows    stacktrace:       @ ms.internal.xcpimports.checkhresult(uint32 hr)    innerexception:  

however custom control correctly drawn. so, how can resolve this? critical issue?

your class pageheadercontrol dependency props registered elevationpageheadercontrol owner..?


Comments

Popular posts from this blog

My HTML document is not linking to my CSS stylesheet properly -

php array slice every 2th rule -

node.js - Sending sockets to client side, Error: Converting circular structure to JSON -