Experiment: Using compiled bindings to make TableView AOT compatible #349
Draft
Experiment: Using compiled bindings to make TableView AOT compatible #349
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends the AOT-safe TableView binding pipeline by generating strongly typed getter and setter logic in the source generator and using that generated setter path from TableView column bindings. The change removes binding dependencies and adds typed two-way editing support for numeric, date, and time inputs while preserving type safety.
Diagnostics codes
These diagnostics are required to fail fast when source-generated TableView wiring cannot be produced safely, and they are emitted during source generation when required XAML metadata, binding type resolution, connector hookup, or member-path resolution is invalid/missing.
TV0001: TableView requires a name for source generation (x:Name/Nameis required).TV0002: Unable to resolveItemsSourceitem type fromx:Bindto a typed generic collection.TV0003: AWindowcontainingTableViewmust callConnectTableViews()in code-behind afterInitializeComponent().TV0004: Unable to resolve a member path for the resolved item type.Generated Wiring (Connector + Provider)
ITableViewConnector(src/ITableViewConnector.cs)partialimplementation of this interface on the XAML root class that ownsTableViewcontrols.ConnectTableView(TableView tableView)connects one specificTableViewinstance by reference and assigns its generatedICellValueProvider.ConnectTableViews()connects all generated/namedTableViewfields in that XAML class in one call.Generated shape (simplified):
ICellValueProvider(src/ICellValueProvider.cs)TableViewand columns:TryGetBindingValue/TrySetBindingValueTryGetSortMemberValueTryGetClipboardContentBindingValueTryGetContentBindingValueTryGetDisplayMemberValueTableViewto implement these methods without reflection.Xaml definition
Generated shape (simplified):
Runtime connection flow
TableView.OnApplyTemplatechecksCellValueProvider.ITableViewConnectorancestor and callsConnectTableView(this).TableView.CellValueProviderfor typed get/set path resolution.