"button" with invisible content [closed]

1

Is there a way to set a content for a button in WPF, but that it is invisible to the user?

    
asked by anonymous 14.10.2015 / 18:42

1 answer

2

No need to do this. Button is button, data is data, they need to be separate. I do not know if I should use a button, but I think the most I should have inside it is a figure, a text that indicates what is there, but this should not be used as a given.

You can do this:

<Button>
    <StackPanel>
        <TextBlock>Texto se achar que deve ter algum</TextBlock>
        <Image Source="submarino.png" />
    </StackPanel>
</Button>

There are cases that might be useful like this:

<Button>
   <StackPanel Orientation="Horizontal">
       <Image Source="destroierParte1.png" />
       <Label>Texto aqui</Label>
   </StackPanel>
</Button>

In WPF you can compose in many ways, you have to use creativity.

Obviously, it will probably start source with an image hiding the object to be shown. When it is clicked the image should be changed, perhaps invoking some effects. In the change, you will change the data vector that will control which parts have already been seen and will trigger an event when every ship is shown, will update board, etc.

Anyway, just giving a few tips, seems simple, but there are several things that need to happen in a naval battle.

    
14.10.2015 / 19:19