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

11.1.0-beta1 Exception occurred while editing DataGrid #15081

Closed
WillisXue opened this issue Mar 22, 2024 · 1 comment · Fixed by #15716
Closed

11.1.0-beta1 Exception occurred while editing DataGrid #15081

WillisXue opened this issue Mar 22, 2024 · 1 comment · Fixed by #15716

Comments

@WillisXue
Copy link
Contributor

Describe the bug

Exception occurred while editing DataGrid
image

To Reproduce

DataGridEditingIssue.zip

Expected behavior

no exception

Avalonia version

11.1.0-beta1

OS

No response

Additional context

No response

@WillisXue WillisXue added the bug label Mar 22, 2024
@timunie
Copy link
Contributor

timunie commented Mar 22, 2024

consider using DataGridTemplateColumn

grokys added a commit that referenced this issue May 14, 2024
grokys added a commit that referenced this issue May 14, 2024
Usually it is not necessary to provide the target property when creating a `BindingExpression` because the property will be assigned when the binding expression is attached to the target in `BindingExpressionBase.Attach`.

This is however one case where `Attach` is not called: when the obsolete `binding.Initiate` method is called and then an observable is read from the `InstancedBinding` without the binding actually being attached to the target object. In this case, prior to the binding refactor in #13970 the value produced by the observable was still converted to the target type. After #13970, because the target property (and hence the target type) is not yet set, the conversion is to the target type is no longer done.

`DataGrid` uses this obsolete method when editing cells, causing #15081. Ideally we'd fix that in `DataGrid` but I'm not happy making this change so close to 11.1, so instead fix this use-case to behave as before.

Fixes #15081
github-merge-queue bot pushed a commit that referenced this issue May 14, 2024
* Added failing tests for #15081.

* Provide target property in BindingExpression ctor.

Usually it is not necessary to provide the target property when creating a `BindingExpression` because the property will be assigned when the binding expression is attached to the target in `BindingExpressionBase.Attach`.

This is however one case where `Attach` is not called: when the obsolete `binding.Initiate` method is called and then an observable is read from the `InstancedBinding` without the binding actually being attached to the target object. In this case, prior to the binding refactor in #13970 the value produced by the observable was still converted to the target type. After #13970, because the target property (and hence the target type) is not yet set, the conversion is to the target type is no longer done.

`DataGrid` uses this obsolete method when editing cells, causing #15081. Ideally we'd fix that in `DataGrid` but I'm not happy making this change so close to 11.1, so instead fix this use-case to behave as before.

Fixes #15081
grokys added a commit that referenced this issue Jun 3, 2024
* Added failing tests for #15081.

* Provide target property in BindingExpression ctor.

Usually it is not necessary to provide the target property when creating a `BindingExpression` because the property will be assigned when the binding expression is attached to the target in `BindingExpressionBase.Attach`.

This is however one case where `Attach` is not called: when the obsolete `binding.Initiate` method is called and then an observable is read from the `InstancedBinding` without the binding actually being attached to the target object. In this case, prior to the binding refactor in #13970 the value produced by the observable was still converted to the target type. After #13970, because the target property (and hence the target type) is not yet set, the conversion is to the target type is no longer done.

`DataGrid` uses this obsolete method when editing cells, causing #15081. Ideally we'd fix that in `DataGrid` but I'm not happy making this change so close to 11.1, so instead fix this use-case to behave as before.

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

Successfully merging a pull request may close this issue.

3 participants