Skip to content

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

Open
@AndrewKeepCoding

Description

@AndrewKeepCoding

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.

Metadata

Metadata

Labels

area/code-generationCategorizes an issue or PR as relevant to code generationdifficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/bugSomething isn't workingtriage/untriagedIndicates an issue requires triaging or verification

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions