miroxlav
miroxlav

Reputation: 12194

How to add control to grid cell in designer without editing XAML?

I want to add control into WPF Grid cell 0,0 just by using mouse&menus.

I can easily do it

To my surprise I found out I'm unable to add it simply by using mouse & menus. If I use drag&drop, control (yellow) is not inserted into specific cell of grid, but placed where I dropped it, ignoring cell boundaries (the grid is highlighted by orange):

enter image description here

How can I add control into cell 0,0 just by clicking in designer?

I've checked few online tutorials, authors always go the XAML way.

Upvotes: 1

Views: 921

Answers (1)

Neeraj
Neeraj

Reputation: 606

Here are your steps :

    1. Hover around the layout near edges of layout in designer till see see a yellow line.
    2. Click to create grid rows and columns when u see this yellow line to create rows and columns.
    3. Drag a control and place it in the grid at a corner (to avoid Margins) Your mouse pointer should stand near the pointer for this to occur.
    4. In case of a mistake use the locks near the margins to turn on or of the margin.
    5. Even after placing drag to the corner is possible.

Please notice the XAML Generated.

Refer attached:

Attached in an image with a grid created using above steps

Upvotes: 2

Related Questions