0
我有一個問題如何從PopUp控件獲取用戶信息? 我從MSDN這個代碼,但我不能菲格爾如何像文本框和複選框... 我只找到了Windows Phone 7和它不一樣的獲取用戶輸入...從彈出窗口獲取用戶信息電話8
Popup p = new Popup();
private void showPopup_Click(object sender, RoutedEventArgs e)
{
// Create some content to show in the popup. Typically you would
// create a user control.
StackPanel panel1 = new StackPanel();
Button button1 = new Button();
Border border = new Border();
border.BorderBrush = new SolidColorBrush(Colors.Black);
border.BorderThickness = new Thickness(5.0);
panel1.Background = new SolidColorBrush(Colors.Blue);
button1.Content = "Close";
button1.Margin = new Thickness(5.0);
button1.Click += new RoutedEventHandler(button1_Click);
TextBlock textblock1 = new TextBlock();
textblock1.FontSize = 30;
textblock1.Text = "The popup control";
textblock1.Margin = new Thickness(5.0);
panel1.Children.Add(textblock1);
panel1.Children.Add(button1);
CheckBox cb = new CheckBox();
cb.Name="check";
panel1.Children.Add(cb);
TextBox tb = new TextBox();
tb.Name = "TB";
panel1.Children.Add(tb);
border.Child = panel1;
border.Name = "BD";
// Set the Child property of Popup to the border
// which contains a stackpanel, textblock and button.
p.Child = border;
// Set where the popup will show up on the screen.
p.VerticalOffset = 25;
p.HorizontalOffset = 25;
// Open the popup.
p.IsOpen = true;
}
void button1_Click(object sender, RoutedEventArgs e)
{
// Close the popup.
//I need to get the info here ...
//p.FindName("BD");//doesnt work...
p.IsOpen = false;
}