Live Chat Icon For mobile
Live Chat Icon

How do I position the children of a Canvas at a discreet X but stretch them vertically to fill?

Platform: WPF| Category: Canvas

You can do so by binding the child’s Height to the Canvas’s ActualHeight, as follows:

[XAML]

<Canvas Name='myCanvas'>
	<Grid Canvas.Left='10' Width='20' Height='{Binding ElementName=myCanvas, Path=ActualHeight}' >
	</Grid>
</Canvas>

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.