Change Usercontrol textblock from MainWindow
Hi I got user control called "Order" and In "Order" control, I got another user control "Status". Then, I put Order Control into the Mainwindow. When the users change language, I write as below.
// change culture info.
this.Order.lbl_test.Content = resBundle.GetString("Resources", "Order.Label.Content.Test");
I also have one textblock in "Status" UserControl. How could I change th开发者_C百科is textblock text from MainWindow like I changed Order control lable?
Assign an x:Name (e.g., "StatusText") to the TextBlock in your Status UserControl. Then add a property to your Order control called StatusText:
public string StatusText
{
get { return Status.StatusText.Text; }
set { Status.StatusText.Text = value; }
}
You can now say:
this.Order.StatusText = resBundle.GetString("Resources", "SomeLabel");
精彩评论