Skip to content

Hyperlink.UnderlineStyleProperty is declared internal; should be public (WinUI API parity) #23652

Closed

Description

@MartinZikmund

Current behavior

Microsoft.UI.Xaml.Documents.Hyperlink.UnderlineStyleProperty is declared internal in Uno, so it is not accessible from outside the Uno.UI assembly:

internal static DependencyProperty UnderlineStyleProperty { get; } =

internal static DependencyProperty UnderlineStyleProperty { get; } =
    DependencyProperty.Register(
        "UnderlineStyle",
        typeof(UnderlineStyle),
        typeof(Hyperlink),
        new FrameworkPropertyMetadata(...));

The CLR wrapper Hyperlink.UnderlineStyle is public, but the DependencyProperty identifier field is internal. Any external code that needs the identifier — e.g. GetValue/SetValue/ClearValue, SetBinding, a Setter in a style, or an animation targeting the property — fails to compile:

error CS0117: 'Hyperlink' does not contain a definition for 'UnderlineStyleProperty'

Expected behavior

In WinUI / Windows App SDK the identifier is public:

public static DependencyProperty UnderlineStyleProperty { get; }

Docs: https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.documents.hyperlink.underlinestyleproperty

For API parity, Uno should expose Hyperlink.UnderlineStyleProperty as public, like every other public dependency-property identifier. The fix appears to be purely the accessibility modifier (internal → public); the DP is already fully registered and functional.

How to reproduce

From any project referencing Uno.WinUI (e.g. a Skia head):

using Microsoft.UI.Xaml.Documents;

var link = new Hyperlink();

link.UnderlineStyle = UnderlineStyle.None;          // OK — CLR property is public
link.ClearValue(Hyperlink.UnderlineStyleProperty);  // CS0117 — identifier is internal

The first line compiles; the second does not.

Workaround

Set the CLR property directly (link.UnderlineStyle = ...) and avoid referencing the DP identifier. This loses DP-based scenarios (ClearValue, bindings, styles, animations against UnderlineStyleProperty).

Environment

  • Uno.WinUI: reproduced on 6.7.0-dev.534; the internal modifier is still present on master (commit ace8db8).
  • Target: net10.0-desktop (Skia). The field lives in shared Uno.UI source, so all heads are affected.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions