我能想到的唯一例子是html - 如果你动态添加一个TR w /一个colspan + div,其中包含详细信息(可编辑),例如点击之前的TR
我正试图找到XAML,想看看是否有人能指出我这个古怪的要求正确的方向.
这是一些东西,不确定它是否是你想要的:
XAML:
码:
public Window1() { InitializeComponent(); CreateRow(); // Bootstrap } private void CreateRow() { RowDefinition newRow = new RowDefinition(); newRow.Height = new GridLength(0, GridUnitType.Auto); _mainGrid.RowDefinitions.Insert(_mainGrid.RowDefinitions.Count - 1, newRow); int rowIndex = _mainGrid.RowDefinitions.Count - 2; UIElement editControl = CreateEditControl(); Grid.SetRow(editControl, rowIndex); Grid.SetColumn(editControl, 1); Grid.SetRowSpan(editControl, 1); Grid.SetColumnSpan(editControl, 1); // Change this if you want. _mainGrid.Children.Add(editControl); Button addButton = new Button(); addButton.Content = "Add"; addButton.Click += new RoutedEventHandler(b_Click); Grid.SetRow(addButton, rowIndex); Grid.SetColumn(addButton, 0); _mainGrid.Children.Add(addButton); addButton.Tag = editControl; } void b_Click(object sender, RoutedEventArgs e) { CreateRow(); Control button = (Control)sender; UIElement editControl = (UIElement)button.Tag; _mainGrid.Children.Remove(button); Grid.SetColumn(editControl, 0); Grid.SetColumnSpan(editControl, 2); } private UIElement CreateEditControl() { return new TextBox(); }