protected override void OnInitialized(EventArgs e) { windowSize = new WindowSize(this); SourceInitialized += windowSize.OnSourceInitialized; base.OnInitialized(e); }