• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

<EventTrigger RoutedEvent="Button.Click">

H

Horst Klein

#1
I have an idea, but I dont know how to realise it in XAML.
The online dokumentation gives not really an anser to my problem.

So, what will I do?

I try to call a custom Class, Property or Methode (with whatever it works)
with an Trigger (EventTrigger, ActionTrigger or whatever it works)

<Button x:Name="MyButton" Content="Button">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<UseMyClass>

</UseMyClass>
</EventTrigger>
</Button.Triggers>
</Button>

How can I do that?

Thanks for support.
Horst
 

My Computer

K

Keith Patrick

#2
You can call a custom property with:
<Setter PropertyName="" Value=""/>

There is a whole family of XSetter's

Not sure about methods, and classes are not executable per se unless you
count a main() method, in which case you wouldn't have to support "class
execution" anyway since method execution would cover it via the main().
 

My Computer

T

thelemmings@gmail.com

#3
Why not try something simple like:
<Button x:Name="MyButton" Content="Button" Click="MyOnClickMethod" />

With an implemention of MyOnClickMethod in your code behind:
void Click="MyOnClickMethod"(object sender, RoutedEventArgs rea)
{
// Do your stuff
}

Luc

Horst Klein wrote:
> I have an idea, but I dont know how to realise it in XAML.
> The online dokumentation gives not really an anser to my problem.
>
> So, what will I do?
>
> I try to call a custom Class, Property or Methode (with whatever it works)
> with an Trigger (EventTrigger, ActionTrigger or whatever it works)
>
> <Button x:Name="MyButton" Content="Button">
> <Button.Triggers>
> <EventTrigger RoutedEvent="Button.Click">
> <UseMyClass>
>
> </UseMyClass>
> </EventTrigger>
> </Button.Triggers>
> </Button>
>
> How can I do that?
>
> Thanks for support.
> Horst
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)