Click here to Skip to main content
15,904,024 members

Comments by cmbay (Top 2 by date)

cmbay 19-Jan-16 15:12pm View    
Sergey,
I was able to bind to the Window's Background property using the XAML below as you suggested, thanks for the help. My implementation has the drawback of not binding to the nearest container in the visual tree. Also I don't see a way to override the binding by setting the Background property at a higher level. The implementation requires setting the ancestor's type so this prevents using the Background property of another context such as a Boarder without also changing the ancestor type. I am beginning to favor doing this in code by finding the nearest ancestor in my visual tree that has a Background property and setting the brush in that way.

Brush="{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type Window}}, Path=Background }"
cmbay 18-Jan-16 8:50am View    
Thanks for your reply to my question. I have two issues with transparency. The first is that the control may be z-order above another control that I don't want to show thru. The second issue is that touch events are more difficult to capture when part of a control is transparent. So the question is, is it possible to bind the Background of my control to its' container's background without explicitly identifying the container? If it can be done how do I do it.