WinForms Dock=Fill in WPF

Today while designing a WPF form, I was using a TabControl and wanted to fill it entirely on the window.

In WinForms we would reach out to the Dock property of TabControl and select 'Fill'. However we do not have Dock property in WPF controls.

Solution: We can use the alignment properties to achieve the same effect:

<TabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

You will need to remove Height, Width and Margin properties of the control to make it fill.


Popular Posts