0

I have the following test code, based on the example in Catel-LATEST:

    <StackPanel VerticalAlignment="Center">
        <TextBox Name="testTarget" Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged, FallbackValue='Test Target'}" Background="Aquamarine">
            <i:Interaction.Behaviors>
                <catel:Focus FocusMoment="Event" Source="{Binding ElementName=mouseEnter}" EventName="MouseEnter" FocusDelay="0" />
                <catel:Focus FocusMoment="Event" Source="{Binding ElementName=mouseLeftButtonUp}" EventName="MouseLeftButtonUp" FocusDelay="0"/>
            </i:Interaction.Behaviors>
        </TextBox>
        <TextBox Name="mouseEnter" Text="Mouse Enter"/>
        <TextBox Name="mouseLeftButtonUp" Text="Left Button Up"/>
    </StackPanel>

I can click on mouseEnter and then move the mouse away and back, and focus moves to testTarget, as desired. But when I left-click on mouseLeftButtonUp, it stays on that control. Am I doing something wrong? Or perhaps there's a restricted list of EventName values that FocusMoment responds to?

user3657408
  • 89
  • 1
  • 7

1 Answers1

0

Looks good. If you believe you found a bug, please create an official ticket on the Catel repository with a repro.

Geert van Horrik
  • 5,689
  • 1
  • 18
  • 32
  • "with a repo"? Meaning, I suppose, code to reproduce it? If so, I could provide the XAML of the window, or I could attach the whole solution. What are you looking for? – user3657408 Apr 09 '20 at 18:07
  • 1
    Oh, wait. You said "repro" as in reproduce. OK, I'll go ahead and submit. – user3657408 Apr 09 '20 at 19:03
  • When I directly subscribe to the events (as in regular event handlers), the events are not fired either, so that's the core of the issue. For more information, see https://stackoverflow.com/questions/318288/wpf-mouseleftbuttonup-not-firing. The solution is to use PreviewMouseLeftButtonUp (which is always invoked, no matter whether it's handled or not). – Geert van Horrik Apr 10 '20 at 08:12