DaveDev
DaveDev

Reputation: 42185

How to access Canvas.Left property of a StackPanel in code?

suppose I have the following XAML:

<Canvas Grid.Column="3" HorizontalAlignment="Right" >

    <StackPanel Name="myStackPanel" Canvas.Left="80">

    </StackPanel>
</Canvas>

How can I access/modify the Canvas.Left property of the StackPanel in code?

Simply writing

myStackPanel.Left // not a property of StackPanel

doesn't work

Upvotes: 0

Views: 3548

Answers (1)

DaveDev
DaveDev

Reputation: 42185

Just figured it:

Canvas.SetLeft(myStackPanel, newValue);

Upvotes: 2

Related Questions