Zdravim. Mám kód uvedený nižšie. TextBoxy a a b sa mi zobrazujú pod sebou. Ja by som potreboval, aby sa zobrazovali vedľa seba. Poradí mi niekto, prosím.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfAddTextBox
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
int textBoxCislo =1;
public MainWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
GenerateTextBox();
}
private void GenerateTextBox()
{
TextBox txtNumber = new TextBox();
TextBox txtNumber1 = new TextBox();
txtNumber.Name = "a" + textBoxCislo.ToString();
txtNumber.Text = textBoxCislo.ToString();
txtNumber1.Name = "b" + textBoxCislo+1.ToString();
txtNumber1.Text = textBoxCislo+1.ToString();
stackPanel1.Children.Add(txtNumber);
stackPanel1.Children.Add(txtNumber1);
stackPanel1.RegisterName(txtNumber.Name, txtNumber);
stackPanel1.RegisterName(txtNumber1.Name, txtNumber1);
textBoxCislo += 1;
}
}
}
|