1 Replies - 4695 Views - Last Post: 06 July 2012 - 06:13 AM Rate Topic: -----

#1 Gimbal5401  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-July 12

Referencing Parent Window from a child Page

Posted 06 July 2012 - 02:08 AM

Hi,
I seem to be struggling with a problem that seems like it should be straightforward to fix.

I have a wpf application that has a main window. This window stays open for the entire life of the program.
All of the content is loaded into pages within the main window.

My question is this:
How can i get or set the value of a TextBlock in the parent window from the page?

I've tried referencing it direct

Dim userid as string = Masterwindow.TextUserID.Text


I've tried

dim master as new MasterWindow
Dim userid as string = master.TextUserID.Text


but I cant actually grab the value that is held.
I cant seem to set it either.

Can someone please give me a simple example of how I can do this?
Or at least point me in the right direction?
I've tried google but have so far had no luck.

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Referencing Parent Window from a child Page

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5432
  • View blog
  • Posts: 11,643
  • Joined: 02-June 10

Re: Referencing Parent Window from a child Page

Posted 06 July 2012 - 06:13 AM

Quote

How can i get or set the value of a TextBlock in the parent window from the page?

You aren't supposed to. The child raises an event, the parent subscribes to that event. The child takes care of itself, the parent takes care of itself.


See FAQ # 3. (Click the SHOW button below)



TOP most asked:
What does this error message mean?
FAQ 2: How do I debug
FAQ 3: How do I make Class1/Form1 talk to Class2/Form2


FAQ (Frequently Asked Questions - Updated July 2012
Spoiler



Was This Post Helpful? 1
  • +
  • -

Page 1 of 1