Frodo
Topic Author
Posts: 11
Joined: 09 Oct 2014, 20:01

Make empty grid cells clickable

11 Dec 2014, 09:43

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.
 
User avatar
sfernandez
Site Admin
Posts: 1970
Joined: 22 Dec 2011, 19:20

Re: Make empty grid cells clickable

11 Dec 2014, 11:21

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.
 
Frodo
Topic Author
Posts: 11
Joined: 09 Oct 2014, 20:01

Re: Make empty grid cells clickable

11 Dec 2014, 14:02

Thanks, this worked for me!

Thank you for your help.

Who is online

Users browsing this forum: No registered users and 1 guest