We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Returning UnsetValue in IValueConverter.ConvertBack is reported as a binding error after the binding system refactor (#13970) in 11.1.0-rc2.
UnsetValue
IValueConverter.ConvertBack
System.InvalidCastException: Could not convert '(unset)' (Avalonia.UnsetValueType) to System.Object.
In 11.0, no errors happen.
View:
<Window xmlns="https://github.com/avaloniaui" xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:local="clr-namespace:Sandbox" x:Class="Sandbox.MainWindow" x:DataType="local:MainViewModel"> <Window.Resources> <local:SomeConverter x:Key="SomeConverter" /> </Window.Resources> <Window.DataContext> <local:MainViewModel /> </Window.DataContext> <TextBox Text="{Binding Value, Converter={StaticResource SomeConverter}}" /> </Window>
VM:
#nullable enable namespace Sandbox; public class MainViewModel { public object? Value { get; set; } }
Converter:
#nullable enable using System; using System.Globalization; using Avalonia; using Avalonia.Data.Converters; namespace Sandbox; public sealed class SomeConverter : IValueConverter { public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) => value; public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => AvaloniaProperty.UnsetValue; }
Type anything in the textbox.
No errors are reported.
11.1.0-rc2, master 376a841
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Returning
UnsetValue
inIValueConverter.ConvertBack
is reported as a binding error after the binding system refactor (#13970) in 11.1.0-rc2.In 11.0, no errors happen.
To Reproduce
View:
VM:
Converter:
Type anything in the textbox.
Expected behavior
No errors are reported.
Avalonia version
11.1.0-rc2, master 376a841
OS
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: