{"record":{"id":"228ff15a8b4f850b","repo":"dotnet/wpf","slug":"sr-invalidsttvalue","errorCode":null,"errorMessage":"SR.InvalidSttValue","messagePattern":"SR\\.InvalidSttValue","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/DrawingAttributes.cs","lineNumber":133,"sourceCode":"        /// </summary>\n        public Matrix StylusTipTransform\n        {\n            get\n            {\n                //prevent boxing / unboxing if possible\n                if (!_extendedProperties.Contains(KnownIds.StylusTipTransform))\n                {\n                    Debug.Assert(Matrix.Identity == (Matrix)GetDefaultDrawingAttributeValue(KnownIds.StylusTipTransform));\n                    return Matrix.Identity;\n                }\n                return (Matrix)GetExtendedPropertyBackedProperty(KnownIds.StylusTipTransform);\n            }\n            set\n            {\n                Matrix m = (Matrix) value;\n                if (m.OffsetX != 0 || m.OffsetY != 0)\n                {\n                    throw new ArgumentException(SR.InvalidSttValue, nameof(value));\n                }\n                //no need to raise change events, they will bubble up from the EPC\n                //underneath us\n                // Validation of value is done in EPC\n                SetExtendedPropertyBackedProperty(KnownIds.StylusTipTransform, value);\n            }\n        }\n\n        /// <summary>\n        /// The height of the StylusTip\n        /// </summary>\n        public double Height\n        {\n            get\n            {\n                //prevent boxing / unboxing if possible\n                if (!_extendedProperties.Contains(KnownIds.StylusHeight))\n                {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Ink/DrawingAttributes.cs#L115-L151","documentation":"DrawingAttributes.StylusTipTransform setter throws ArgumentException with SR.InvalidSttValue when the assigned Matrix has a non-zero OffsetX or OffsetY. StylusTipTransform is a transform applied around the stylus tip origin, so translation components are meaningless and rejected; only rotation/scale/skew matrices are accepted. Validation of the matrix structure itself is deferred to the underlying ExtendedPropertyCollection.","triggerScenarios":"Assigning a Matrix built with translation, e.g. new Matrix(1,0,0,1, 10, 20) or one obtained from a TranslateTransform, to DrawingAttributes.StylusTipTransform.","commonSituations":"Developers copy a Matrix from a RenderTransform (which commonly includes translation offsets) and reuse it for StylusTipTransform; composing transforms with TranslateTransform before converting to Matrix.","solutions":["Zero out OffsetX and OffsetY before assigning: m.OffsetX = 0; m.OffsetY = 0;","Build the matrix only from Rotate/Scale/Skew transforms (never TranslateTransform).","If translation is needed, apply it elsewhere (e.g. positioning the ink canvas), not in StylusTipTransform."],"exampleFix":"// before\nvar m = new Matrix(1, 0, 0, 1, 10, 20);\nda.StylusTipTransform = m; // ArgumentException\n// after\nvar m = new Matrix(1, 0, 0, 1, 0, 0);\nda.StylusTipTransform = m; // or set m.OffsetX = m.OffsetY = 0 first","handlingStrategy":"validation","validationCode":"bool IsStylusTipTransformLegal(Matrix m) => m.OffsetX == 0 && m.OffsetY == 0;\n// before assigning:\n// if (!IsStylusTipTransformLegal(m)) m.OffsetX = m.OffsetY = 0;","typeGuard":"static bool HasNoTranslation(Matrix m) => m.OffsetX == 0 && m.OffsetY == 0;","tryCatchPattern":"try { da.StylusTipTransform = m; }\ncatch (ArgumentException) { m.OffsetX = 0; m.OffsetY = 0; da.StylusTipTransform = m; }","preventionTips":["Never assign matrices derived from TranslateTransform to StylusTipTransform","Zero offsets explicitly when reusing transform matrices from layout code","Remember StylusTipTransform allows only shape transforms (rotate/scale/skew)"],"tags":["wpf","ink","matrix","argumentexception"],"backgroundTag":"invalid-argument-value","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}