Пример #1
0
 public static void Initialize(this UIElement element)
 {
     var userControl = new UserControl { Content = element };
     userControl.BeginInit(); // hacking different things here
     userControl.Measure(new Size(100, 100));
     userControl.Arrange(new Rect(new Size(100, 100)));
     element.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent));
 }