GraphicsDevice.DisplayMode Property

Retrieves the display mode's spatial resolution, color resolution, and refresh frequency.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public DisplayMode DisplayMode { get; }

Property Value

Data describing the display mode of the adapter (as opposed to the display mode of the GraphicsDevice, which might not be active if the GraphicsDevice does not own full-screen mode).

For a list of all supported display modes for an adapter, see the SupportedDisplayModes property.

This simple example checks for a supported display mode and sets the back buffer dimensions to match the resolution of the desired display mode.

public class Game1 : Microsoft.Xna.Framework.Game
    GraphicsDeviceManager graphics;

    public Game1()
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

        graphics.PreparingDeviceSettings +=
            new EventHandler<PreparingDeviceSettingsEventArgs>(

    /// <summary>
    /// Modifies the display mode for the graphics device 
    /// when it is reset or recreated.
    /// </summary>
    void graphics_PreparingDeviceSettings(object sender, 
        PreparingDeviceSettingsEventArgs e)
        foreach (Microsoft.Xna.Framework.Graphics.DisplayMode displayMode 
            in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
            // If 1080i (Widescreen) format is available, 
            // set it to use this format.
            // 1080i is 1920�1080, so check to see if there is a 
            // DisplayMode available that matches.
            if (displayMode.Width == 1920 && displayMode.Height == 1080)
                    BackBufferFormat = displayMode.Format;
                    BackBufferHeight = displayMode.Height;
                    BackBufferWidth = displayMode.Width;
                    FullScreenRefreshRateInHz = displayMode.RefreshRate;
                    IsFullScreen = true;

Xbox 360, Windows XP SP2, Windows Vista, Zune

Community Additions