Closed as not planned
Closed as not planned
Code quality
Description
Description
We have a problem about SourceGenerator - that is we cannot reference to the generated property in advance. Whenever I hover on the property, Visual Studio tells me there's a error that there's no such a property in the project because the proeprty is not declared explicitly although they will be disappeared in building.
Current:
namespace Files.App.UserControls
{
[DependencyProperty<ToolbarViewModel>("ViewModel")]
public sealed partial class PathBreadcrumb : UserControl
{
private void PathItemSeparator_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
=> ViewModel.PathItemSeparator_DataContextChanged(sender, args);
}
}
Proposal:
namespace Files.App.UserControls
{
public sealed partial class PathBreadcrumb : UserControl
{
[DependencyProperty]
pubilc ToolbarViewModel ViewModel { get; set; }
private void PathItemSeparator_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
=> ViewModel.PathItemSeparator_DataContextChanged(sender, args);
}
}
Concerned code
- Files.Core.SourceGenerator
Gains
- A better readability.
- A better maintainability.
Requirements
- Update source generation way
Comments
No response
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done