Мне нужно рассчитать Width
каждого UIElement
в пользовательской панели. Если цикл над Children
:Как установить DesiredSize.Width UIElement?
foreach (UIElement child in Children) { ... }
Я не могу сделать child.DesiredSize.Width = myCalculatedWidth;
так DesiredSize
и DesiredSize.Width
только для чтения.
Документов сказать, что Measure()
обновляет DesiredSize
в UIElement
, поэтому я попытался:
Size size = new Size(myCalculatedWidth, Double.PositiveInfinity);
child.Measure(size);
Но child.DesiredSize.Width
неизменен. Как установить DesiredSize.Width
?
'UIElement' не имеет свойства' Width'. – d7samurai