Silverlight ChildWindow - 使用文本框更新标签

Silverlight ChildWindow - Update label with textbox

我在 C# 中有非常简单的代码来显示 MessageBox:

MessageBox.Show("Hello Action!");

现在我需要执行以下操作:用 Silverlight ChildWindow 元素替换 MessageBox,添加标签、按钮和文本框,然后按下按钮使用文本框内容更新标签内容。

怎么做? 我没有在网上找到一些例子。

我的完整代码是这样的:

namespace DevTrainingSilverlight2
{
    public class HelloAction : W6Action
    {
        public override void Initialize(W6ActionConfigSection configuration, UIElement containingControl, UIElement associatedControl)
        {
            base.Initialize(configuration, containingControl, associatedControl);
        }

        public override void UpdateState(System.Collections.IList selectedObjectsInFocus)
        {
            base.UpdateState(selectedObjectsInFocus);
        }

        public override void Invoke(System.Collections.IList selectedObjectsInFocus)
        {
            base.Invoke(selectedObjectsInFocus);
            MessageBox.Show("Hello Action!");
        }
    }
}

在 silverlight 中将文本框和按钮添加到子窗口。

并且您可以在打开时将内容作为参数传递并更新,如下所示。

 ChildWindowControl childControl = new ChildWindowControl(content);
 childControl.Show();

修改Childwindow的构造函数如下,

public ChildWindowControl(string name)
 {
   InitializeComponent();
   this.lblValue = name;
 }