c# - Binding to UserControl property with casting -


i have list of usercontrols binded itemssource of of treeview. in tabcontrol.itemtemplate have bind property of custom usercontrol.

i have tried everything, nothing worked me.

<tabcontrol.itemtemplate>      <datatemplate>           <stackpanel orientation="horizontal">                <textblock text="{binding headertitle"></textblock>      ... <tabcontrol.itemtemplate> 

my usercontrol:

public partial class fulltextsearchresult : usercontrol, inotifypropertychanged {     public viewmodelbase viewmodel { get; set; }     private string _headertitle;     public string headertitle     {         { return _headertitle; }         set         {             _headertitle = value;             handlepropertychanged("headertitle");         }     }      public fulltextsearchresult(viewmodelbase model)     {         headertitle = (model fulltextsearchresultviewmodel).model.headertitle;          initializecomponent();          #region viewmodel configuration          viewmodel = model;         datacontext = viewmodel;          #endregion     }      public event propertychangedeventhandler propertychanged;      public void handlepropertychanged(string prop)     {         if (propertychanged != null)             propertychanged(this, new propertychangedeventargs(prop));     } } 

any idea how it? have tried converters, maybe in incorrect way.

best regards.


Comments