Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi everyone

I want to access my controls like button or textbox in mainWindow in wpf, but I cant do this.
in windows form application its so easy, you can set modifier of that control to True and you can reach that control from instance of that mainWindow, but in WPF I can't declare a pubic control, How ca I do this?
Posted
Updated 30-Nov-12 0:50am
v2
Comments
thursunamy 30-Nov-12 9:51am    
In WPF actually all controls are public. Are you sure you cant reach controls from codebehind ?

1 solution

XML
Just declare your control like this to make it public:

<TextBox x:Name="textBox1" x:FieldModifier="public" />

You can then access it from another control.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900