Skip to content

Applying dependencyProperty in the case of string type #10329

@Senso4sLab

Description

@Senso4sLab

Describe the bug

I created the UserControl with the following DependecyProperty:

 public string? Text
 {
     get => (string?)GetValue(TextProperty);
     set => SetValue(TextProperty, value);
 }
 
 public static readonly DependencyProperty TextProperty =
     DependencyProperty.RegisterAttached(nameof(Text), typeof(string), typeof(ColoredStringBox), new PropertyMetadata(null));

When the UserControl is used on one of my pages where the property Text has the value null, I would expect the same value of Text property inside UserControl, but unfortunately, the value is equal to ""(string.Empty). Is there any special reason for this or is it a bug?

Steps to reproduce the bug

Please check the problem description!

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions