-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templated XAML controls for WinUI 3 C# #3868
Comments
May be duplicate of: #3657 |
@get-flat are you testing on preview 2 or 3? The version info states both :) |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
@StephenLPeters I'm using version [Microsoft.WinUI 3.0.0-preview3.201113.0] |
@evelynwu-msft FYI |
@get-flat Thanks for your report! The exception you're seeing is known and non-fatal; execution can be safely continued past it. Alternatively, if you find it too noisy, you can disable the I'll talk to our writer and see about getting the sample documentation updated to correct the errors you identified. |
The sample documentation has been updated to note that:
|
The good news is that I don't get an Exception, the downside however is that I can't get this to work at all. Also, isn't there something missing for this handler to be called? (I assume the curly bracket repeat is just a typo): private static void OnLabelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
{
BgLabelControl labelControl = d as BgLabelControl; //null checks omitted
String s = e.NewValue as String; //null checks omitted
if (s == String.Empty)
{
labelControl.HasLabelValue = false;
}
else
{
labelControl.HasLabelValue = true;
}
}
} My project: |
Thanks for catching this. In order for the changed handler to be invoked you have to register the callback:
The article has been updated with this change (and the superfluous brackets have been removed). Thanks again! |
Thanks for clearing that up @drewbatgit I can successfully set a breakpoint on the handler, so the property is definitely updated. You can check my code here: https://github.com/Herdubreid/BgLabelControlApp |
Describe the bug
Exception on InitializeComponent:
Exception thrown at 0x75A246D2 in BgLabelControlApp.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x02DBDE68.
Steps to reproduce the bug
Steps to reproduce the behavior:
Expected behavior
No crash
Update documentation to provide working example
Screenshots
Version Info
Version 16.9.0 Preview 2.0 (vanilla C# only installation - https://docs.microsoft.com/en-us/windows/apps/winui/winui3/)
NuGet package version:
[Microsoft.WinUI 3.0.0-preview3.201113.0]
Windows app type:
Additional context
Please fix documentation: Generic.xaml is autogenerated when new CustomControl is added.
Please update documentation: "Name the new control "BgLabelControl" and click Add. This will add two new files to your project. BgLabelControl.cs contains the code-behind for the control." What should be the other file? Only .cs file is created.
The text was updated successfully, but these errors were encountered: