0

I need to put a stackpanel inside the table cell but if i did my logic like this....

DataGrid dg = new DataGrid();

StackPanel sp = new StackPanel();

sp.Height = 18;

sp.Width = 60;

sp.Orientation = Orientation.Horizontal;

Button btn = new Button();

btn.Width = 10;

btn.Height = 10;

sp.Children.Add(btn);

Label bt = new Label();

bt.Content = "test";

bt.Margin = new Thickness(0, -3, 0, 0);

sp.Children.Add(bt);

DataTable dt = new DataTable();

DataColumn dc = new DataColumn("hello");

dt.Columns.Add(dc);

DataRow dr = dt.NewRow();

dr[0] = sp; dt.Rows.Add(dr);

dg.ItemsSource = dt.DefaultView;

l1.Content = dg;

it is showing "System.Windows.Controls.StackPanel" in the cell..... how to get a StackPanel(with multiple Controls) in side the GridView cell

1 Answer 1

0

You should create custom template for your grid cells. See this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.