UISettings class

Applies to Windows and Windows Phone

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

Syntax


public sealed class UISettings

Attributes

[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The UISettings class has these types of members:

Constructors

The UISettings class has these constructors.

ConstructorDescription
UISettings Creates a new default instance of the UISettings class.

 

Events

The UISettings class has these events.

EventDescription
TextScaleFactorChanged Occurs when the system text size setting is changed.

 

Methods

The UISettings class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

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

 

Properties

The UISettings class has these properties.

PropertyAccess typeDescription

AnimationsEnabled

Read-onlyGets whether animations are enabled for the user interface.

CaretBlinkRate

Read-onlyGets the blink rate of a new caret created by the app view.

CaretBrowsingEnabled

Read-onlyGets whether the caret can be used for browse operations.

CaretWidth

Read-onlyGets the width of a new caret created by the app view.

CursorSize

Read-onlyGets the size of a new cursor created by the app view.

DoubleClickTime

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

HandPreference

Read-onlyGets the directional preference of the user interface created by the app view.

MessageDuration

Read-onlyGets the length of time a message is displayed for the app view.

MouseHoverTime

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

ScrollBarArrowSize

Read-onlyGets the size of a scroll bar arrow for windows associated with the app view.

ScrollBarSize

Read-onlyGets the size of a scroll bar for windows associated with the app view.

ScrollBarThumbBoxSize

Read-onlyGets the size of a thumb box for windows associated with the app view.

TextScaleFactor

Read-onlyGets the value of the system text size setting.

 

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;
  }
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.UI.ViewManagement
Windows::UI::ViewManagement [C++]

Metadata

Windows.winmd

See also

UI contrast and settings sample

 

 

Show:
© 2014 Microsoft