R – When writing the xaml for the user controls should I remove grid and use dock panel or something else

user-controlswpfxaml

I am adding user controls in my solution. The main page of my project will have a dock panel. When writing the xaml for my user controls should I remove grid and use dock panel or what? Iam using visual studio express and WPF.

Best Answer

The answer is it depends on what you want your control to look like.

Remember the Grid is to help you orgainze your controls. You can define features like columns widths, row heights, and other styling.

While a dock panel is to help dock your control to a part of the form or another.

So it depends on what you want your control to look like. You can nest a grid in a dock panel and vice versa. There is no set rule. It is really up to you.