Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获取 StackPanel.Children 项的 Width 或 ActualWith?
foreach (var item in stackPanel1.Children) { // item.Width ??? }
谢谢!
使用FrameworkElement类,因为ActualWidth并且Width属于这个基类-
FrameworkElement
ActualWidth
Width
foreach (FrameworkElement item in stackPanel1.Children) { double width = item.ActualWidth; }