Page 1 of 1

Make empty grid cells clickable

Posted: 11 Dec 2014, 09:43
by Frodo
Hi

I'm trying to make the entire grid clickable - even the empty cells should fire a click event.
When I set the background attribute of the layoutroot (grid) to transparent (Background="Transparent"), the grid responds to the click event, but everything turns black!

In WPF this issue can be solved by setting AllowsTransparency="True", but this attribut seems not to exist in NoesisGUI.

How can this be solved in NoesisGUI?

Thank you for your help.

Re: Make empty grid cells clickable

Posted: 11 Dec 2014, 11:21
by sfernandez
This is a problem we had in 1.1 version. It happens that we use the first element that draws to the surface to decide whether to do a Clear of the color buffer. If that first item fills the entire surface and has a background with a SolidColorBrush, then we do a Clear operation instead of drawing a quad.

That is what is happening in your sample, because the layoutRoot Grid is probably the first element being rendered and has the exact surface dimensions, then we are doing a Clear with a Transparent color, which means that everything gets black. If you want to avoid this, you can make your Grid a bit smaller or bigger using the Margin:
<Grid x:Name="LayoutRoot" Background="Transparent" Margin="1">
   ...
</Grid>
Because this is less than intuitive, we changed it in 1.2. In that version you don't have to worry about anything, we only do a Clear when rendering to texture, so you can start with a transparent texture.

Re: Make empty grid cells clickable

Posted: 11 Dec 2014, 14:02
by Frodo
Thanks, this worked for me!

Thank you for your help.