private void addexp_click(object sender, RoutedEventArgs e) { if (_rowcount >= 4) { return; } querypanel.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); var idx = querypanel.RowDefinitions.Count - 1; var searchrow = new SearchRow(); searchrow.DetermineFieldCallback = this.DetermineFieldCallback; searchrow.CreateControlCallback = this.CreateControlCallback; searchrow.RenderRow(_intputType); Grid.SetRow(searchrow, idx); Grid.SetColumn(searchrow, 1); querypanel.Children.Add(searchrow); var removebn = new Button(); StyleHelper.ApplyStyle(removebn, "remove_bn"); removebn.Click += (s, e2) => { querypanel.Children.Remove(removebn); querypanel.Children.Remove(searchrow); _rowcount--; }; Grid.SetRow(removebn, idx); querypanel.Children.Add(removebn); _rowcount++; }
private void addexp_click(object sender, RoutedEventArgs e) { if (_rowcount >= 4) { return; } querypanel.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0,GridUnitType.Auto) }); var idx = querypanel.RowDefinitions.Count - 1; var searchrow = new SearchRow(); searchrow.DetermineFieldCallback = this.DetermineFieldCallback; searchrow.CreateControlCallback = this.CreateControlCallback; searchrow.RenderRow(_intputType); Grid.SetRow(searchrow, idx); Grid.SetColumn(searchrow, 1); querypanel.Children.Add(searchrow); var removebn = new Button(); StyleHelper.ApplyStyle(removebn, "remove_bn"); removebn.Click += (s, e2) => { querypanel.Children.Remove(removebn); querypanel.Children.Remove(searchrow); _rowcount--; }; Grid.SetRow(removebn, idx); querypanel.Children.Add(removebn); _rowcount++; }