Setting property of type System.Type in XAML doesn't set the property
See original GitHub issueI’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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (9 by maintainers)
Top Results From Across the Web
c# - Using System.Type in XAML
Use the x:Type Markup Extension: <MyUserControl xmlns:myns="clr-namespace:My.NameSpace" x:Name="TheControl" TheType="{x:Type ...
Read more >x:Type Markup Extension - XAML
The x:Type markup extension supplies a from-string conversion behavior for properties that take the type Type. The input is a XAML type.
Read more >XAML Magic: Attached Properties
Fundamentally, the Dependency Property system is a way to first define a property and register it with the overall Dependency Property system, ...
Read more >Avoiding binding errors when part of the path is null - Forums
Anyway, in this particular scenario I see that Noesis considers a binding error when a property of the binding path returns null and...
Read more >Code annotation attributes | ReSharper Documentation
Use this annotation to specify a type that contains static or const fields with values for the annotated property/field/parameter.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve opened a task for WinUI 3 so if the compiler encounters something like
TypeProperty="local:Foo"
, it will generate type information forFoo
so this scenario will work without a dummy class/adding theBindable
attribute.Keeping this open until it’s available in a public release