8 thoughts on “A Basic Borderless WPF Window (with Bad Drop Shadow)

  1. I have a little problem with that. My window is created by costom window style, not like your’s. So I created borders in style and now there’s my problem. Border is created like that:


    In that case I can’t call constructor like you do, cause first I need to get reference to that borders. That references I getting like this:
    this.m_TopLeft = (FrameworkElement)this.Template.FindName(“m_TopLeft”, this);

    I thought that now I can call the constructor, but there is a small problem – this element are not available when construction of window is performed, so this.m_TopLeft = null.

    Hmm I thought ok, then I’ll get those references on window event Loaded. So now I have my needed references to border’s in Loaded event, but when calling constructor of WindowResizer – it’s inner member hwndSource = null after initializing… I looked inside and I saw this thing:
    window.SourceInitialized += (o, e) => hwndSource = (HwndSource)PresentationSource.FromVisual((Visual)o);
    So the event just doesn’t raise and hwndSource = null. Ok I thout I will change event to SourceUpdater, or Loaded – but still that doeesnt work. Can u help me please, cause I’m out of ideas at all. Thanks!

  2. Thanks very much for sharing, that was really helpful on my project :). I think if you have transparent window but opaque border background, you can set RenderOptions.ClearTypeHint=”Enabled” on this border to make ClearType work, no?

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.