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

AttachedProperty setter is not called in XAML when named Uid #19069

Open
AndrewKeepCoding opened this issue Dec 13, 2024 · 0 comments
Open

AttachedProperty setter is not called in XAML when named Uid #19069

AndrewKeepCoding opened this issue Dec 13, 2024 · 0 comments
Labels
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

Comments

@AndrewKeepCoding
Copy link
Contributor

Current behavior

As it's mentioned in the title, AttachedProperty setter is not called in XAML when named Uid
This happens on:

  • Android
  • WASM
  • Desktop
  • MacOS

It works as expected

  • on WASDK
  • the AttachedProperty has other name
  • the setter is called on C# code

For example:

Uids.cs

public static class Uids
{
    public static readonly DependencyProperty UidProperty =
        DependencyProperty.RegisterAttached(
            "Uid",
            typeof(string),
            typeof(Uids),
            new PropertyMetadata(default));

    public static string GetUid(DependencyObject obj) => (string)obj.GetValue(UidProperty);

    public static void SetUid(DependencyObject obj, string value) => obj.SetValue(UidProperty, value);
}

MainPage.xaml

<Button
    x:Name="GoToSecondButton"
    AutomationProperties.AutomationId="SecondPageButton"
    local:Uids.Uid="ButtonUid"
    Command="{Binding GoToSecond}"
    Content="Go to Second Page" />

MainPage.xaml.cs

private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    var buttonUid = Uids.GetUid(GoToSecondButton);
    // butonUid is null.
    GoToSecondButton.Content = buttonUid;
}

Expected behavior

The AttatchedProperty setter should be called even if it's name is Uid.

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

Here is a reproducible repo:
https://github.com/AndrewKeepCoding/UnoPlatformAttatchedPropertyDemo

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

Uno.Sdk v5.5.32

Affected platforms

WebAssembly, Android, iOS, Mac Catalyst, Skia (WPF)

IDE

Visual Studio 2022

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

It might be related to x:Uid.

@AndrewKeepCoding AndrewKeepCoding 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 Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Projects
None yet
Development

No branches or pull requests

1 participant