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

ViewLocator param name should follow the interface #277

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

maxkatz6
Copy link
Member

Closes #269

@maxkatz6 maxkatz6 merged commit 1e43d89 into main Nov 15, 2024
1 of 2 checks passed
var control = (Control)Activator.CreateInstance(type)!;
control.DataContext = data;
return control;
return (Control)Activator.CreateInstance(type)!;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, is there a reason for making this change? The F# template still has the previous default behavior (which I personally prefer)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was made to match our other template: https://github.com/AvaloniaUI/avalonia-dotnet-templates/blob/main/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs

Also, hardcoding DataContext in this code potentially can be problematic. Typically, DataContext should be inherited from parent instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change F# template, as I can't confidently code in F# or test it.
If you think it should also be updated in any way, and can test it, please open a PR, I can review it at least.

Copy link
Contributor

@MalzSmith MalzSmith Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this makes sense, thanks for getting back to me. I was so happy about being a (somewhat real) contributor with #238 but I understand your reasoning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ViewLocator causes warning CA1725
2 participants