Trigger for one control, set the focus.

Markus Freitag 3,786 Reputation points
2020-08-06T15:02:52.897+00:00

Hello,

16138-2f2.png

One more questions.

A)
I have a control, a button and only this button should set the focus on another control of a TextBox after the mouse click.
Can't I assign the trigger directly to the control, see code?

B)
I have a control, a button and only this button should set the focus on another control of a TextBox after
the function calling after the mouse click returns true.
16128-2w2.png

16008-2global2.png

I find that when i create the references globally, i later lose overview. It is more difficult to find the context.

I am looking for a good practical solution, so I ask again. Thank you very much for your help with examples.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,784 questions
0 comments No comments
{count} votes

Accepted answer
  1. Peter Fleischer (former MVP) 19,326 Reputation points
    2020-08-06T18:29:36.743+00:00

    Hi Markus,
    without business logic only in XAML you can bind element by name:

    16197-x.png

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.