I have created a trigger in the xaml and it works fine. However, when I want to access one of its properties in the code behind it always gives me a null value.
Anyone knows why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sounds like you are referencing the class and not the instantiated trigger.
Take a look at this example. It shows accessing a trigger in C#. Maybe this will get you in the right direction.
The code that should help is the following:
or you could do something like this:
Here is a small example. Where an EventTrigger is added to a text box named TextBoxInvoker.
Then to access the trigger via code you can do the following. This will get you the collection of triggers attached to the element.
or