Alex Rivera | Logout

Docking/Filling in WPF

Asked 2011-01-12T18:08:09.437
11

This seems like such a simple question, but I have been trying for an hour and can't seem to figure it out.

All I want to do is fill the MainWindow with a Canvas. I couldn't find any properties to allow this, and the only way I could think of to do it is to set Canvas.Width/Height = MainWindow.Width/Height, but I would have to do that every time the window is resized.

In WinForms docking an element in a parent container was easy.

Edit
Report

1 Answer

3

put this for your canvas width and height in xaml.

Width="{Binding Path=ActualWidth, ElementName=Window1}"
Height="{Binding Path=ActualHeight, ElementName=Window1}"

it should change accordingly when you resize the window

answered 2011-01-12T18:10:55.113

Your Answer