你可以返回一个 stackPanel ,里面有text和button
var stackPanel = new StackPanel();
stackPanel.Orientation = Orientation.Horizontal;
var button = new Button()
{
Content = "Delete",
Margin = new Thickness(5, 5, 5, 5)
};
var text = new TextBlock();
text.Text = "abc";
stackPanel.Children.Add(text);
stackPanel.Children.Add(button);
dobj = new ControlDrawingObject(row, column, stackPanel);
吧_rootElement 的类型改成FrameworkElement
private FrameworkElement _rootElement; |