{"record":{"id":"28f7e9b89f00e6f4","repo":"dotnet/wpf","slug":"sr-transformnotsupported","errorCode":null,"errorMessage":"SR.TransformNotSupported","messagePattern":"SR\\.TransformNotSupported","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs","lineNumber":6307,"sourceCode":"                using (HwndStyleManager sm = HwndStyleManager.StartManaging(this, StyleFromHwnd, StyleExFromHwnd ))\n                {\n                    CreateRtl();\n                }\n            }\n        }\n\n        private static object CoerceRenderTransform(DependencyObject d, object value)\n        {\n            Transform renderTransformValue = (Transform)value;\n\n            if ((value == null) ||\n                (renderTransformValue != null && renderTransformValue.Value.IsIdentity))\n            {\n                // setting this value is allowed.\n            }\n            else\n            {\n                throw new InvalidOperationException(SR.TransformNotSupported);\n            }\n\n            return value;\n        }\n\n        private static void _OnRenderTransformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)\n        {\n        }\n\n        private static object CoerceClipToBounds(DependencyObject d, object value)\n        {\n            if ((bool)value)\n            {\n                throw new InvalidOperationException(SR.ClipToBoundsNotSupported);\n            }\n            return value;\n        }\n","sourceCodeStart":6289,"sourceCodeEnd":6325,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs#L6289-L6325","documentation":"A top-level HWND window cannot be rendered with arbitrary transforms (rotation, skew, scale); the OS composits the window as a whole. Window.CoerceRenderTransform allows only an identity (or null) RenderTransform and throws InvalidOperationException for any real transform. This is a deliberate WPF restriction on the Window class, not a bug.","triggerScenarios":"Assigning a non-identity Transform (RotateTransform, ScaleTransform, TranslateTransform with non-zero values, TransformGroup, etc.) to Window.RenderTransform in code or XAML, or via a binding/style that applies a transform to the window.","commonSituations":"Copying a control's style/template to a Window, databinding RenderTransform with an animated transform, applying an entrance animation transform to the whole window.","solutions":["Remove the RenderTransform from the Window and apply it to an inner root element (e.g. Grid or Border) instead","Animate/transform the root child element's RenderTransform rather than the window's","If a transform on the window itself is truly needed, host content in a borderless window and transform inner content"],"exampleFix":"// before\n<Window RenderTransform=\"...\"><Grid/></Window>\n// after\n<Window><Grid RenderTransform=\"...\">...</Grid></Window>","handlingStrategy":"validation","validationCode":"bool canApply = window.RenderTransform == null || window.RenderTransform is Transform t && t.Value.IsIdentity;","typeGuard":"static bool IsIdentityTransform(Transform t) => t == null || t.Value.IsIdentity;","tryCatchPattern":"try { window.RenderTransform = transform; } catch (InvalidOperationException) { rootElement.RenderTransform = transform; }","preventionTips":["Never share control styles that set RenderTransform with Window","Apply transforms to the window's root child element, not the Window","Use styles scoped with x:Key instead of implicit Window styles carrying transforms"],"tags":["wpf","window","rendertransform","not-supported"],"backgroundTag":"unsupported-operation","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"}