private void _InitializeWindowCornerRadius() { // The radius of window corners isn't exposed as a true system parameter. // It instead is a logical size that we're approximating based on the current theme. // There aren't any known variations based on theme color. Assert.IsNeitherNullNorEmpty(UxThemeName); // These radii are approximate. The way WPF does rounding is different than how // rounded-rectangle HRGNs are created, which is also different than the actual // round corners on themed Windows. For now we're not exposing anything to // mitigate the differences. var cornerRadius = default(CornerRadius); // This list is known to be incomplete and very much not future-proof. // On XP there are at least a couple of shipped themes that this won't catch, // "Zune" and "Royale", but WPF doesn't know about these either. // If a new theme was to replace Aero, then this will fall back on "classic" behaviors. // This isn't ideal, but it's not the end of the world. WPF will generally have problems anyways. switch (UxThemeName.ToUpperInvariant()) { case "LUNA": cornerRadius = new CornerRadius(6, 6, 0, 0); break; case "AERO": // Aero has two cases. One with glass and one without... if (NativeMethods.DwmIsCompositionEnabled()) { cornerRadius = new CornerRadius(8); } else { cornerRadius = new CornerRadius(6, 6, 0, 0); } break; case "CLASSIC": case "ZUNE": case "ROYALE": default: cornerRadius = new CornerRadius(0); break; } WindowCornerRadius = cornerRadius; }
private void _InitializeWindowCornerRadius() { Assert.IsNeitherNullNorEmpty(UxThemeName); var cornerRadius = default(CornerRadius); switch (UxThemeName.ToUpperInvariant()) { case "LUNA": cornerRadius = new CornerRadius(6, 6, 0, 0); break; case "AERO": cornerRadius = NativeMethods.DwmIsCompositionEnabled() ? new CornerRadius(8) : new CornerRadius(6, 6, 0, 0); break; default: cornerRadius = new CornerRadius(0); break; } WindowCornerRadius = cornerRadius; }