开发者

Change Usercontrol textblock from MainWindow

开发者 https://www.devze.com 2023-03-17 23:23 出处:网络
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.

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");
0

精彩评论

暂无评论...
验证码 换一张
取 消