protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            if (HasBuiltInScaling)
            {
                this.SystemDpi = Dpi.FromVisual(this);
            }
            else
            {
                this._source = (HwndSource)PresentationSource.FromVisual(this);
                if (this._source == null)
                {
                    return;
                }
                this._source.AddHook(this.WndProc);

                this.SystemDpi = Dpi.FromPresentationSource(this._source);
            }
            this.WindowDpi = this.SystemDpi;
        }