Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#-XAML:如何打开一个带有文本框和按钮点击的菜单?_C#_Xaml_Windows Phone 8 - Fatal编程技术网

c#-XAML:如何打开一个带有文本框和按钮点击的菜单?

c#-XAML:如何打开一个带有文本框和按钮点击的菜单?,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我想打开一个矩形框菜单与文本框和按钮,当按钮在appbar按下。让我再解释一下我的问题 我想在我的应用程序中有搜索选项。所以,我的应用程序栏中有搜索图标。当用户想要搜索时,他向上滑动应用程序栏并按下搜索图标 按下搜索图标时,应打开包含文本框和按钮的矩形框菜单 我不知道如何用C#和XAML编写代码。请帮帮我。每一个答案都将不胜感激 您可以从中使用CustomMessageBox,并在其中插入Textbox TextBox txtBox = new TextBox(); txtBox.Width =

我想打开一个矩形框菜单与文本框和按钮,当按钮在appbar按下。让我再解释一下我的问题

我想在我的应用程序中有搜索选项。所以,我的应用程序栏中有搜索图标。当用户想要搜索时,他向上滑动应用程序栏并按下搜索图标

按下搜索图标时,应打开包含文本框和按钮的矩形框菜单


我不知道如何用C#和XAML编写代码。请帮帮我。每一个答案都将不胜感激

您可以从中使用
CustomMessageBox
,并在其中插入
Textbox

TextBox txtBox = new TextBox();
txtBox.Width = 460;
txtBox.Text = selectedChild.Name;
txtBox.HorizontalAlignment = HorizontalAlignment.Center;
txtBox.MaxLength = 14;


CustomMessageBox messageBox = new CustomMessageBox();
messageBox.Caption = "hello";
messageBox.Content = txtBox;
messageBox.LeftButtonContent = "OK";
messageBox.RightButtonContent = "Cancel";
messageBox.IsFullScreen = false;
messageBox.Dismissed += MessageBoxDismissed;
messageBox.Show();
这是回拨电话

private void MessageBoxDismissed(object sender, DismissedEventArgs e)
{
    CustomMessageBox messageBox = sender as CustomMessageBox;
    if (messageBox != null && e.Result == CustomMessageBoxResult.LeftButton)
    {
        TextBox tb = messageBox.Content as TextBox;
        if (tb != null && !string.IsNullOrEmpty(tb.Text.Trim()))
        {
           //do your stuff
        }
    }
    else
    {
    }
}

这个问题的完美答案是使用NuGet。你可以从

通过单击以下链接,您可以在CustomMessageBox中输入初始化文本框的代码:

是的,您必须安装wptoolkit。这是我从NuGet安装的所有东西。谢谢你的建议。努吉,很好用。但是你的密码在我的案子里不起作用。我在按钮事件中调用了上述代码