Skip to content

Setting property of type System.Type in XAML doesn't set the property #4161

@azchohfi

Description

@azchohfi

I've validated that this works fine in OS/XAML:

Steps to reproduce the bug
Latest WinUI3-preview4 (but this is not a regression from preview3, it just never worked in WinUI3)

    public class GraphPresenter : ContentPresenter
    {
        public GraphPresenter()
        {
            Loaded += GraphPresenter_Loaded;
        }

        public Type ResponseType { get; set; }

        private void GraphPresenter_Loaded(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine(ResponseType); // This should have the type, but its null
        }
    }
    public class AnyClass
    {
    }
<local:GraphPresenter ResponseType="local:AnyClass"/>

Works totally fine in OS/XAML and the property is never set in WInUI3.

Expected behavior
Simple C# properties of type System.Type should be populated by setting the property in Xaml.

Version Info
WinUI3 Desktop app with version 3.0.0-preview4.210210.4

NuGet package version:
[Microsoft.WinUI 3.0.0-preview4.210210.4]

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions