Measuring controls created at runtime in WPF
问题 I recognise this is a popular question but I couldn't find anything that answered it exactly, but I apologise if I've missed something in my searches. I'm trying to create and then measure a control at runtime using the following code (the measurements will then be used to marquee-style scroll the controls - each control is a different size): Label lb = new Label(); lb.DataContext= task; Style style = (Style)FindResource("taskStyle"); lb.Style = style; cnvMain.Children.Insert(0,lb); width =