0

Could be a user control completely transparent?

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
mc:Ignorable="d"
x:Class="MainWindow.UserControl3"

Width="600" Height="600">
<Grid x:Name="LayoutRoot" Background="Transparent"/>
</UserControl>

if I execute the previous code the result is a black window, not transparent why? Thanks

G.Zana
  • 11
  • 7
  • 2
    Have you tried to add also `Background="Transparent"` to the UserControl itself ? (not the grid) – Xodrow Oct 29 '15 at 16:01
  • ' ' ...thanks @Xodrow, nothing changed ... – G.Zana Oct 30 '15 at 12:50
  • Your MainPage... what color is it? – Martin Oct 30 '15 at 14:00
  • Hi @Martin, under this I have another page (UserControl) opened before, full of buttons of different colors. the background is a standard gradient brush set by Blend (I used Blend program for creation of pages...) thanks – G.Zana Oct 30 '15 at 15:13
  • No any idea at regards? ...my desire would be to display a transparent window that overlap the other views, in this way I will hide the underneath controls, preventing them to get the focus. Thanks – G.Zana Nov 05 '15 at 13:11
  • If your overall goal is just to inhibit focus of the UserControl, it might be easier to just put a bool condition on IsHitTestVisible for the entire usercontrol like – Chris W. Nov 23 '15 at 21:41
  • Thank @ChrisW. for the hint. I reported the simplest example up there, just to say I never found the way to overlap two usercontrol leaving the topmost transparent, for some parts, not completely. In my intention the top window would be an alarm message that cover only partially the window behind. Now I turned around the problem loading programmatically a transparent bitmap in a stack panel of the visualhost. – G.Zana Nov 26 '15 at 14:10

0 Answers0