Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Accesing mainwindiow controls from other class in WPF

$
0
0

I am creating a text changed event for a textbox in Mainwindow and text changed event i call a class after calling that class i want to reset textbox content to "" how to do it easily i used

internalstatic fooNameSpace.MainWindow tW1;// in foo.csMainWindow.tW1.txtBlock1.Text="This is a paragraph";

but it doent work 

i tried in foo.cs

MainWindow mw = new MainWindow();
mw.textbox.text="";

still nothing i want to change textbox.text="" in my current main window which is visible and if i put it inside textchanged event handler then it is cleared so fast  that i am not even able to see it

any help would be highly appreciated?



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>