Vixen
dd8b0a81
csharp
public readonly record struct MediaContext

What a media query is asked about.

Read the guide page for this →

Remarks

A surface rather than a screen. A game's UI can be a full window, a split-screen viewport or a world-space panel on the side of a crate, and all three want @media (max-width: …) to mean "this panel", never "the monitor".

⚠ Gamut is the one fact here that is about output rather than layout, and it is still a property of the surface. The honest source for it is ISwapChain.Gamut — what the swapchain was granted — rather than what the display claims to be capable of. A panel rendered into an sRGB swapchain on a P3 monitor can show sRGB, and a stylesheet told otherwise would pick colours that get mapped away again.

⚠ Preferences is a value and not six more parameters here, because those six arrive together from the platform while these five each have a source of their own. See MediaPreferences.

Fields and properties (6)

  • public float Width

    The surface width in logical pixels.

  • public float Height

    The surface height in logical pixels.

  • public float Resolution

    Device pixels per logical pixel.

  • public ColorSchemePreference ColorScheme

    The palette preference.

  • public ColorGamut Gamut

    What the surface can actually show, which is the swapchain's granted gamut and not the monitor's specification sheet.

  • public MediaPreferences Preferences

    The platform's accessibility settings.

Methods (1)

Used by (20)

  • AccessibilityWiringTestsVixen.Platform.Ui.Tests
  • CascadeFixtureVixen.Ui.Styling.Tests
  • CascadeOrderTestsVixen.Ui.Styling.Tests
  • CompositionTestsVixen.Ui.Styling.Utilities.Tests
  • ContainerQueryTestsVixen.Ui.Styling.Tests
  • EntryVixen.Ui.Styling
  • MediaConditionsVixen.Ui.Styling
  • MediaQueryVixen.Ui.Styling
  • MediaScopesVixen.Ui.Styling
  • ReducedMotionTestsVixen.Ui.Styling.Tests
  • SheetVixen.Ui.Styling
  • StyleEngineVixen.Ui.Styling
  • StyleSheetLoaderVixen.Ui.Styling
  • StyleSheetLoadingTestsVixen.Ui.Styling.Tests
  • UiDocumentVixen.Ui
  • UiSurfaceVixen.Ui
  • UtilityFixtureVixen.Ui.Styling.Utilities.Tests
  • UtilityGenerationTestsVixen.Ui.Styling.Utilities.Tests
  • VariantCoverageTestsVixen.Ui.Styling.Utilities.Tests
  • WideGamutTestsVixen.Ui.Styling.Tests