Select to view content in your preferred language

A Help Box for Buttons

561
1
07-14-2010 06:14 AM
jonataspovoas
Regular Contributor
Hi,

I have a project that has some menus, and in it a lot of buttons. I use a service tooltip to show Help, but now I need to create a function that will switch the buttons function to show a help box with info on the clicked button.

On the Xaml, here's an example of a Button:

<Button x:Name="btnToggleTOC" Style="{StaticResource MenuButtonStyle}"  ToolTipService.ToolTip="Lista Camadas do Mapa" Width="45" Height="40" Click="mostraPainelEsquerdo_Click">
[INDENT]<Image Source="Images/layers.png" />[/INDENT]
</Button>

and here's it's Function on C#:

private void mostraPainelEsquerdo_Click(object sender, RoutedEventArgs e)
{
[INDENT][INDENT]if (painelEsquerdo.Visibility == Visibility.Collapsed)
{
[INDENT][INDENT]painelEsquerdo.Visibility = Visibility.Visible;[/INDENT][/INDENT]
}
else
{
[INDENT][INDENT]painelEsquerdo.Visibility = Visibility.Collapsed;[/INDENT][/INDENT]
}
[/INDENT][/INDENT]}

And a screenshot of one of the menus:


So, here's my question: How can I use a function to change the next mouse action of EVERY button to show a help box with operational info, that will be diferent for each button, and without getting my code dirty? This Function will the activated once I click the (?) button shown on the screenshot.
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor
I would probably create a new type of button class (inherits from Button), and give it a boolean property to say whether its in "help mode". Then bind this property to help checkbox.
Override the Click method, and raise the "HelpClick" event instead of the Click event. Alternatively you could have the button pop up the help window, and have a help description property on the button as well.
0 Kudos