UISettings UISettings UISettings UISettings Class

Definition

Contains a set of common app user interface settings and operations.

public sealed class UISettingspublic sealed class UISettingsPublic NotInheritable Class UISettingspublic sealed class UISettings
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

void SDKSample::HighContrast::UI::UIGetSettings_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{ 
  Button^ b = safe_cast<Button^>(sender);
  if (b != nullptr)
  {
    UISettings^ pUserSettings = ref new UISettings();
    Platform::String^ Buffer;
    Windows::UI::Color Color;

        Buffer =  "Hand Preference " + (pUserSettings->HandPreference == HandPreference::RightHanded ? "right" : "left") + "\n";
        Buffer += "Cursor Size "  + pUserSettings->CursorSize.Width.ToString() + " x " + pUserSettings->CursorSize.Height.ToString() + "\n";
        Buffer += "Scrollbar Size "  + pUserSettings->ScrollBarSize.Width.ToString() + " x " + pUserSettings->ScrollBarSize.Height.ToString() + "\n";
        Buffer += "Scrollbar Arrow Size "   + pUserSettings->ScrollBarArrowSize.Width.ToString() + " x " + pUserSettings->ScrollBarArrowSize.Height.ToString() + "\n";
        Buffer += "Scrollbar Thumb Box Size " + pUserSettings->ScrollBarThumbBoxSize.Width.ToString() + " x " + pUserSettings->ScrollBarThumbBoxSize.Height.ToString() + "\n";
        Buffer += "Message Duration "  + pUserSettings->MessageDuration.ToString() + "\n";
        Buffer += "Animations Enabled "  + (pUserSettings->AnimationsEnabled ? "true" : "false") + "\n"; 
        Buffer += "Caret Browsing Enabled "  + (pUserSettings->CaretBrowsingEnabled ? "true" : "false") + "\n";
        Buffer += "Caret Blink Rate "  + pUserSettings->CaretBlinkRate.ToString() + "\n";
        Buffer += "Caret Width " + pUserSettings->CaretWidth.ToString() + "\n";
        Buffer += "Double Click Time " + pUserSettings->DoubleClickTime.ToString() + "\n";
        Buffer += "Mouse Hover Time " + pUserSettings->MouseHoverTime.ToString() + "\n";

        Buffer += "System Colors: \n";

        Color = pUserSettings->UIElementColor(UIElementType::ActiveCaption);
        Buffer += "Active Caption: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Background);
        Buffer += "Background: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::ButtonFace);
        Buffer += "Button Face: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::ButtonText);
        Buffer += "Button Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::CaptionText);
        Buffer += "Caption Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::GrayText);
        Buffer += "Gray Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Highlight);
        Buffer += "Highlight: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::HighlightText);
        Buffer += "Highlight Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Hotlight);
        Buffer += "Hotlight: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::InactiveCaption);
        Buffer += "Inactive Caption: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::InactiveCaptionText);
        Buffer += "Inactive Caption Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::Window);
        Buffer += "Window: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";
        Color = pUserSettings->UIElementColor(UIElementType::WindowText);
        Buffer += "Window Text: " + Color.R.ToString() + ", " + Color.G.ToString() + ", " + Color.B.ToString() + "\n";

    UIOutputTextBlock->Text = Buffer;
  }
}

Constructors

UISettings() UISettings() UISettings() UISettings()

Creates a new default instance of the UISettings class.

public UISettings()public New()Public Sub New()public UISettings()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

AdvancedEffectsEnabled AdvancedEffectsEnabled AdvancedEffectsEnabled AdvancedEffectsEnabled

Prerelease. Gets a value that indicates whether the system Transparency effects setting is enabled.

public bool AdvancedEffectsEnabled { get; }public bool AdvancedEffectsEnabled { get; }Public ReadOnly Property AdvancedEffectsEnabled As boolpublic bool AdvancedEffectsEnabled { get; }
Value
bool bool bool bool

true if Transparency UI effects are enabled; otherwise, false.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

AnimationsEnabled AnimationsEnabled AnimationsEnabled AnimationsEnabled

Gets whether animations are enabled for the user interface.

public bool AnimationsEnabled { get; }public bool AnimationsEnabled { get; }Public ReadOnly Property AnimationsEnabled As boolpublic bool AnimationsEnabled { get; }
Value
bool bool bool bool

true if animations are enabled; false if not.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

CaretBlinkRate CaretBlinkRate CaretBlinkRate CaretBlinkRate

Gets the blink rate of a new caret created by the app view.

public uint CaretBlinkRate { get; }public uint CaretBlinkRate { get; }Public ReadOnly Property CaretBlinkRate As uintpublic uint CaretBlinkRate { get; }
Value
uint uint uint uint

The blink rate of the new caret, in milliseconds.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

CaretBrowsingEnabled CaretBrowsingEnabled CaretBrowsingEnabled CaretBrowsingEnabled

Gets whether the caret can be used for browse operations.

public bool CaretBrowsingEnabled { get; }public bool CaretBrowsingEnabled { get; }Public ReadOnly Property CaretBrowsingEnabled As boolpublic bool CaretBrowsingEnabled { get; }
Value
bool bool bool bool

True if the caret can be used for browse operations; false if it cannot.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

CaretWidth CaretWidth CaretWidth CaretWidth

Gets the width of a new caret created by the app view.

public uint CaretWidth { get; }public uint CaretWidth { get; }Public ReadOnly Property CaretWidth As uintpublic uint CaretWidth { get; }
Value
uint uint uint uint

The width of a new caret, in pixels.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

CursorSize CursorSize CursorSize CursorSize

Gets the size of a new cursor created by the app view.

public Size CursorSize { get; }public Size CursorSize { get; }Public ReadOnly Property CursorSize As Sizepublic Size CursorSize { get; }
Value
Size Size Size Size

The size of a new cursor.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

DoubleClickTime DoubleClickTime DoubleClickTime DoubleClickTime

Gets the maximum allowed time between clicks in a double-click operation.

public uint DoubleClickTime { get; }public uint DoubleClickTime { get; }Public ReadOnly Property DoubleClickTime As uintpublic uint DoubleClickTime { get; }
Value
uint uint uint uint

The delta of a double-click operation, in milliseconds.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

HandPreference HandPreference HandPreference HandPreference

Gets the directional preference of the user interface created by the app view.

public HandPreference HandPreference { get; }public HandPreference HandPreference { get; }Public ReadOnly Property HandPreference As HandPreferencepublic HandPreference HandPreference { get; }
Value
HandPreference HandPreference HandPreference HandPreference

The directional preference of the user interface.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

MessageDuration MessageDuration MessageDuration MessageDuration

Gets the length of time a message is displayed for the app view.

public uint MessageDuration { get; }public uint MessageDuration { get; }Public ReadOnly Property MessageDuration As uintpublic uint MessageDuration { get; }
Value
uint uint uint uint

The duration the message is displayed, in seconds.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

MouseHoverTime MouseHoverTime MouseHoverTime MouseHoverTime

Gets the amount of time the mouse pointer can rest in a hover rectangle before a hover event is raised.

public uint MouseHoverTime { get; }public uint MouseHoverTime { get; }Public ReadOnly Property MouseHoverTime As uintpublic uint MouseHoverTime { get; }
Value
uint uint uint uint

The hover time before a hover event is raised, in milliseconds.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

ScrollBarArrowSize ScrollBarArrowSize ScrollBarArrowSize ScrollBarArrowSize

Gets the size of a scroll bar arrow for windows associated with the app view.

public Size ScrollBarArrowSize { get; }public Size ScrollBarArrowSize { get; }Public ReadOnly Property ScrollBarArrowSize As Sizepublic Size ScrollBarArrowSize { get; }
Value
Size Size Size Size

The size of a scroll bar arrow.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

ScrollBarSize ScrollBarSize ScrollBarSize ScrollBarSize

Gets the size of a scroll bar for windows associated with the app view.

public Size ScrollBarSize { get; }public Size ScrollBarSize { get; }Public ReadOnly Property ScrollBarSize As Sizepublic Size ScrollBarSize { get; }
Value
Size Size Size Size

The size of the scroll bar.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

ScrollBarThumbBoxSize ScrollBarThumbBoxSize ScrollBarThumbBoxSize ScrollBarThumbBoxSize

Gets the size of a thumb box for windows associated with the app view.

public Size ScrollBarThumbBoxSize { get; }public Size ScrollBarThumbBoxSize { get; }Public ReadOnly Property ScrollBarThumbBoxSize As Sizepublic Size ScrollBarThumbBoxSize { get; }
Value
Size Size Size Size

The size of the thumb box.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

TextScaleFactor TextScaleFactor TextScaleFactor TextScaleFactor

Gets the value of the system text size setting.

public double TextScaleFactor { get; }public double TextScaleFactor { get; }Public ReadOnly Property TextScaleFactor As doublepublic double TextScaleFactor { get; }
Value
double double double double

The value ranges from 1 to 2. Very small text is scaled up by a factor equal to this value, or very close to it. You can use the value to scale non-text visuals proportionately with the text. But be aware that not all text is scaled by the same factor. Generally speaking, the larger text is to begin with, the less it’s affected by scaling.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

GetColorValue(UIColorType) GetColorValue(UIColorType) GetColorValue(UIColorType) GetColorValue(UIColorType)

Returns the color value of the specified color type.

public Color GetColorValue(UIColorType desiredColor)public Color GetColorValue(UIColorType desiredColor)Public Function GetColorValue(desiredColor As UIColorType) As Colorpublic Color GetColorValue(UIColorType desiredColor)
Parameters
desiredColor
UIColorType UIColorType UIColorType UIColorType

An enumeration value that specifies the type of color to get a value for.

Returns

The color value of the specified color type.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The UIColorType value is not supported and will cause an exception if used as the desiredColor parameter.

UIElementColor(UIElementType) UIElementColor(UIElementType) UIElementColor(UIElementType) UIElementColor(UIElementType)

Gets the color used for a specific user interface element type, such as a button face or window text.

public Color UIElementColor(UIElementType desiredElement)public Color UIElementColor(UIElementType desiredElement)Public Function UIElementColor(desiredElement As UIElementType) As Colorpublic Color UIElementColor(UIElementType desiredElement)
Parameters
desiredElement
UIElementType UIElementType UIElementType UIElementType

The type of element for which the color will be obtained.

Returns

The color of the element type, expressed as a 32-bit color value.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Events

AdvancedEffectsEnabledChanged AdvancedEffectsEnabledChanged AdvancedEffectsEnabledChanged AdvancedEffectsEnabledChanged

Prerelease. Occurs when the system advanced UI effects setting is enabled or disabled.

public event TypedEventHandler AdvancedEffectsEnabledChangedpublic event TypedEventHandler AdvancedEffectsEnabledChangedPublic Event AdvancedEffectsEnabledChangedpublic event TypedEventHandler AdvancedEffectsEnabledChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

ColorValuesChanged ColorValuesChanged ColorValuesChanged ColorValuesChanged

Occurs when color values have changed.

public event TypedEventHandler ColorValuesChangedpublic event TypedEventHandler ColorValuesChangedPublic Event ColorValuesChangedpublic event TypedEventHandler ColorValuesChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

TextScaleFactorChanged TextScaleFactorChanged TextScaleFactorChanged TextScaleFactorChanged

Occurs when the system text size setting is changed.

public event TypedEventHandler TextScaleFactorChangedpublic event TypedEventHandler TextScaleFactorChangedPublic Event TextScaleFactorChangedpublic event TypedEventHandler TextScaleFactorChanged
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)