Skip to content

View To ViewMode Event Call #19705

Answered by kazo0
RSReswin asked this question in Q&A
Mar 19, 2025 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Hello @RSReswin, apologies for the delay in responding!

This can be achieved with the XamlBehaviors library (NuGet packages Uno.Microsoft.Xaml.Behaviors.Interactivity.WinUI and Uno.Microsoft.Xaml.Behaviors.WinUI.Managed).

For example, if you want to capture a TextBlock being double-tapped, you can add an ICommand to your ViewModel to be invoked on that event:

public ICommand TextBlockDoubleTapped { get; }
<Page
    ...
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    xmlns:interactions="using:Microsoft.Xaml.Interactions.Core">

    <TextBlock x:Name="textBlock" Text="Double-tap me">
        <interactivity:Interaction.Behaviors>
            <interactions:EventTriggerBehavior 

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@RSReswin
Comment options

@DevTKSS
Comment options

Comment options

You must be logged in to vote
1 reply
@RSReswin
Comment options

Answer selected by RSReswin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants