NoWar
NoWar

Reputation: 37633

How to get Width or ActualWith of the StackPanel.Children item

How to get Width or ActualWith of the StackPanel.Children item?

foreach (var item in stackPanel1.Children)
{
 // item.Width ???              
}

Thank you!

Upvotes: 0

Views: 70

Answers (1)

Rohit Vats
Rohit Vats

Reputation: 81233

Use FrameworkElement class since ActualWidth and Width belongs to this base class-

foreach (FrameworkElement item in stackPanel1.Children)
{
    double width = item.ActualWidth;
}

Upvotes: 2

Related Questions