c# - WPF DataBinding with other Namespace/Class -


i´m having problems databinding using wpf. have webservice(wcf) windows service app , wpf app control service. in wpf app, builded textbox want receive logs webservice.

at moment can send new data same namespace (wpf app) when send (wcf app) using instance of data class, dont reflect new data in textbox.

here code:

mainwindow.xaml

...    <grid name="grid" margin="0,0,346.6,4">        <textbox name="log" text="{binding path=logtext}" scrollviewer.cancontentscroll="true" isreadonly="true" borderthickness="0" background="transparent" horizontalalignment="left" textwrapping="wrap" verticalalignment="top" grid.column="2" margin="30.8,35,-325.8,0" height="303" grid.rowspan="2" width="295"/>    </grid> ... 

mainwindow.xaml.cs

public mainwindow()     {                 initializecomponent();                 grid.datacontext = logs.instance;                 ...     }  public class logs : inotifypropertychanged {            private static logs instance;             private logs() { }             public static logs instance            {                              {                  if (instance == null)                  {                      instance = new logs();                  }                  return instance;               }            }              public event propertychangedeventhandler propertychanged;              protected void notify(string propname)             {                 if (this.propertychanged != null)                 {                     propertychanged(this,new propertychangedeventargs(propname));                 }             }               private string _logtext = "";              public string logtext             {                                 {                     return _logtext;                 }                 set                 {                     _logtext = value;                     notify("logtext");                 }             }              public void logbinding(string text)             {                 logtext = text + logtext;             } } 

wcf webservice send text call (other namespace)

using "the namespace of wpf app";  logs.instance.logbinding("some text"); 

thank !

from description sounds have 2 separate applications running separate processes. static instances not shared across processes if they're same class. need use form of cross process communication pass data windows service wpf app.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -