{"id":2925,"date":"2015-03-14T09:07:59","date_gmt":"2015-03-14T09:07:59","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=2925"},"modified":"2015-03-14T09:07:59","modified_gmt":"2015-03-14T09:07:59","slug":"adding-a-drop-shadow-to-a-wpf-popup","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/adding-a-drop-shadow-to-a-wpf-popup\/","title":{"rendered":"Adding a drop shadow to a WPF popup"},"content":{"rendered":"<p>When I display a popup, quite often I want it to stand out a little from the control it&#8217;s displaying over. The most obvious and simplest way to do this is by displaying it with a drop shadow.<\/p>\n<p>Here&#8217;s the code to do this<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;Popup AllowsTransparency=&quot;True&quot;&gt;\r\n   &lt;Grid&gt;\r\n      &lt;Border Margin=&quot;0,0,8,8&quot; Background=&quot;White&quot; BorderThickness=&quot;1&quot;&gt;\r\n         &lt;Border.Effect&gt;\r\n            &lt;DropShadowEffect BlurRadius=&quot;5&quot; Opacity=&quot;0.4&quot;\/&gt;\r\n         &lt;\/Border.Effect&gt;\r\n         &lt;SomeControl\/&gt;\r\n      &lt;\/Border&gt;\r\n   &lt;\/Grid&gt;\r\n&lt;\/Popup&gt;\r\n<\/pre>\n<p>The key things are that you wrap the control(s) you wish to display within the popup inside a Border control and ensure it has a margin. Then set the dropshadow on the border. The next key thing is the popup should AllowTransparency otherwise I&#8217;ve found the border area is just black (i.e. no shadow).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I display a popup, quite often I want it to stand out a little from the control it&#8217;s displaying over. The most obvious and simplest way to do this is by displaying it with a drop shadow. Here&#8217;s the code to do this &lt;Popup AllowsTransparency=&quot;True&quot;&gt; &lt;Grid&gt; &lt;Border Margin=&quot;0,0,8,8&quot; Background=&quot;White&quot; BorderThickness=&quot;1&quot;&gt; &lt;Border.Effect&gt; &lt;DropShadowEffect BlurRadius=&quot;5&quot; Opacity=&quot;0.4&quot;\/&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13],"tags":[],"class_list":["post-2925","post","type-post","status-publish","format-standard","hentry","category-wpf"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/2925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=2925"}],"version-history":[{"count":3,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/2925\/revisions"}],"predecessor-version":[{"id":2957,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/2925\/revisions\/2957"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=2925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=2925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=2925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}