Skip to content
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

Change return type of CanExecuteChanged only for MUX.Input.ICommand #1092

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/cswinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -1317,11 +1317,15 @@ private % Make_%()
{
auto event_type = w.write_temp("%", bind<write_type_name>(get_type_semantics(event.EventType()), typedef_name_type::Projected, false));

// ICommand has a lower-fidelity type mapping where the type of the event handler doesn't project one-to-one
// Microsoft.UI.Xaml.Input.ICommand has a lower-fidelity type mapping where the type of the event handler doesn't project one-to-one
// so we need to hard-code mapping the event handler from the mapped WinRT type to the correct .NET type.
if (event.Name() == "CanExecuteChanged" && event_type == "global::System.EventHandler<object>")
{
event_type = "global::System.EventHandler";
auto parent_type = w.write_temp("%", bind<write_type_name>(event.Parent(), typedef_name_type::NonProjected, true));
if (parent_type == "Microsoft.UI.Xaml.Input.ICommand")
{
event_type = "global::System.EventHandler";
}
}
w.write(R"(
%%%event % %
Expand Down