{"record":{"id":"9cbaeae6c620e91c","repo":"dotnet/wpf","slug":"sr-format-sr-parsercannotconvertpropertyvalue-property","errorCode":null,"errorMessage":"SR.Format(SR.ParserCannotConvertPropertyValue, \"Property\", typeof(DependencyProperty).FullName)","messagePattern":"SR\\.Format\\(SR\\.ParserCannotConvertPropertyValue, \"Property\", typeof\\(DependencyProperty\\)\\.FullName\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/DependencyPropertyConverter.cs","lineNumber":156,"sourceCode":"                    int lastIndex = value.LastIndexOf('.');\n                    string typeName = value.Substring(0, lastIndex);\n                    property = value.Substring(lastIndex + 1);\n\n                    IXamlTypeResolver resolver = serviceProvider.GetService(typeof(IXamlTypeResolver))\n                        as IXamlTypeResolver;\n                    type = resolver.Resolve(typeName);\n                }\n                else\n                {\n                    // Only have the property name\n                    // Strip prefixes if there are any, v3 essentially discards the prefix in this case\n                    int lastIndex = value.LastIndexOf(':');\n                    property = value.Substring(lastIndex + 1);\n                }\n            }\n            else\n            {\n                throw new NotSupportedException(SR.Format(SR.ParserCannotConvertPropertyValue, \"Property\", typeof(DependencyProperty).FullName));\n            }\n\n            // We got additional info from either Trigger.SourceName or Setter.TargetName\n            if (type == null && targetName != null)\n            {\n                IAmbientProvider ambientProvider = serviceProvider.GetService(typeof(IAmbientProvider))\n                    as System.Xaml.IAmbientProvider;\n                XamlSchemaContext schemaContext = (serviceProvider.GetService(typeof(IXamlSchemaContextProvider))\n                    as IXamlSchemaContextProvider).SchemaContext;\n\n                type = GetTypeFromName(schemaContext,\n                    ambientProvider, targetName);\n            }\n\n            // Still don't have a Type so we need to loop up the chain and grab either Style.TargetType,\n            // DataTemplate.DataType, or ControlTemplate.TargetType\n            if (type == null)\n            {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/DependencyPropertyConverter.cs#L138-L174","documentation":"DependencyPropertyConverter.ResolveProperty parses a string like 'OwnerType.Property' into a DependencyProperty. The else-branch throws NotSupportedException when the value has no recognized separator form — i.e. the string is neither owner-qualified nor resolvable through the parsing path, so no 'Property' portion could be extracted.","triggerScenarios":"Setter Property or Trigger Property value given as a bare or malformed string that lacks the expected 'Type.Property' / 'prefix:Type.Property' format, so the value does not contain a parsable property reference.","commonSituations":"XAML like <Setter Property=\"Background\"/> where the value lacks a type qualifier and no owning type can be determined; copy-pasted WPF property strings into a context expecting qualified names; typos dropping the '.Property' part.","solutions":["Qualify the property with its owner type: Property=\"Control.Background\"","Use the x:Static or attached-property syntax appropriate for the property","Check for typos such as a missing '.' between type and property name","If the type must come from TargetName/sourceName, ensure the template context provides it"],"exampleFix":"// before\n<Setter Property=\"Background\" Value=\"Red\"/>// after\n<Setter Property=\"Control.Background\" Value=\"Red\"/>","handlingStrategy":"validation","validationCode":"static bool IsQualifiedProperty(string v) => v != null && v.Contains('.');\nif (!IsQualifiedProperty(propertyString)) throw new ArgumentException(\"Use 'Type.Property' form for Setter/Trigger Property\");","typeGuard":"static bool IsValidDpString(string? v) => !string.IsNullOrEmpty(v) && v.Split('.').Length == 2;","tryCatchPattern":"try { var dp = (DependencyProperty)converter.ConvertFrom(ctx, culture, value); } catch (NotSupportedException ex) when (ex.Message.Contains(\"DependencyProperty\")) { throw new XamlParseException($\"Property '{value}' must be owner-qualified, e.g. 'Control.{value}'\"); }","preventionTips":["Always write Setter/Trigger Property values as Type.PropertyName","Lint XAML for unqualified Property attributes","Check TargetName/TargetType support when relying on template context"],"tags":["xaml","dependency-property","invalid-argument-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}