Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPF]Can't get the clicked element like as UWP #7835

Closed
ywmoyue opened this issue Jan 16, 2022 · 1 comment · Fixed by #7845
Closed

[WPF]Can't get the clicked element like as UWP #7835

ywmoyue opened this issue Jan 16, 2022 · 1 comment · Fixed by #7845
Assignees
Labels
difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers

Comments

@ywmoyue
Copy link

ywmoyue commented Jan 16, 2022

Current behavior

When Tapped or RightTapped is used, TappedRoutedEventArgs.OriginalSource cannot be obtained correctly
unotest
.

Expected behavior

I can get the OriginalSource in UWP.
uwptest

How to reproduce it (as minimally and precisely as possible)

MainPage.xaml :

<Page
    x:Class="TestOriginalSource.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TestOriginalSource"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Tapped="Grid_Tapped">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <TextBlock x:Name="text" Text="Hello, world!" Margin="20" FontSize="30" />
        <Grid Grid.Row="1" Background="Red"></Grid>
    </Grid>
</Page>

MainPage.xaml.cs :

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }
        private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var element = (FrameworkElement)(e.OriginalSource);
            text.Text = element.GetType().Name;
        }
    }

Works on UWP/WinUI

Yes

NuGet package version(s)

Uno.UI.Skia.Wpf 4.1.0-dev.324
Uno.UI.RemoteControl 4.1.0-dev.324

Affected platforms

Skia (WPF)

IDE

Visual Studio 2022, Visual Studio 2019

IDE version

Microsoft Visual Studio Community 2019 16.11.2 Preview 1.0

@ywmoyue ywmoyue added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jan 16, 2022
@MartinZikmund MartinZikmund added difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jan 17, 2022
@MartinZikmund
Copy link
Member

Probably something for @dr1rrb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants