{"record":{"id":"710974859cf8efd5","repo":"stride3d/stride","slug":"convertback-is-not-supported-with-this-valueconverter-710974","errorCode":null,"errorMessage":"ConvertBack is not supported with this ValueConverter.","messagePattern":"ConvertBack is not supported with this ValueConverter\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Translation.Presentation/MarkupExtensions/LocalizeExtension.cs","lineNumber":135,"sourceCode":"                this.assembly = assembly;\n                this.isStringFormat = isStringFormat;\n            }\n\n            /// <inheritdoc />\n            [NotNull]\n            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n            {\n                var count = value != DependencyProperty.UnsetValue ? System.Convert.ToInt32(value, culture) : default(int);\n                var result = string.IsNullOrEmpty(context)\n                    ? TranslationManager.Instance.GetPluralString(text, plural, count, assembly)\n                    : TranslationManager.Instance.GetParticularPluralString(context, text, plural, count, assembly);\n                return isStringFormat? string.Format(result, count) : result;\n            }\n\n            /// <inheritdoc />\n            public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n            {\n                throw new NotSupportedException(\"ConvertBack is not supported with this ValueConverter.\");\n            }\n        }\n    }\n}\n","sourceCodeStart":117,"sourceCodeEnd":140,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Translation.Presentation/MarkupExtensions/LocalizeExtension.cs#L117-L140","documentation":"The internal value converter used by the Localize markup extension performs one-way conversion only (formatting a localized string, optionally with a count for pluralization). Converting a formatted, localized string back to the original source value is impossible, so ConvertBack throws NotSupportedException by design.","triggerScenarios":"Binding with Mode=TwoWay (or OneWayToSource) whose converter is the one created inside LocalizeExtension's ProvideValue/LocalizeExtension.ValueConverter — any attempt by WPF/Avalonia binding to push the UI value back to the source.","commonSituations":"Two-way bindings on Text properties that use Localize; copy-pasting a OneWay binding and switching Mode to TwoWay to make an editable localized field; using Localize in a TextBox/EditContext setup.","solutions":["Use Mode=OneWay (the default) on bindings that use the Localize extension.","For editable localized content, bind to your ViewModel string property directly and handle localization in the ViewModel, not via Localize markup.","Write a custom IMultiValueConverter/IValueConverter that keeps the source key separately if reverse mapping is truly needed."],"exampleFix":"// before\n<TextBlock Text=\"{local:Localize MyKey, Mode=TwoWay}\" />\n// after\n<TextBlock Text=\"{local:Localize MyKey}\" /> <!-- one-way only -->","handlingStrategy":"validation","validationCode":"<!-- ensure binding is one-way -->\n<TextBlock Text=\"{local:Localize MyKey}\" /> <!-- never Mode=TwoWay/OneWayToSource -->","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set TwoWay/OneWayToSource on bindings using the Localize extension","For editable localized text, bind the ViewModel property directly","Remember localization converters are display-only (one-way)"],"tags":["notsupported","binding","localization","oneway"],"backgroundTag":"unsupported-operation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}