UISettings Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Contains a set of common app user interface settings and operations.
public ref class UISettings sealed
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UISettings final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class UISettings final
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UISettings
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class UISettings
function UISettings()
Public NotInheritable Class UISettings
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
Examples
void MainPage::ClickHandler(IInspectable const&, RoutedEventArgs const&)
{
Windows::UI::ViewManagement::UISettings uiSettings;
std::wstringstream buffer;
Windows::UI::Color color{ uiSettings.UIElementColor(UIElementType::ActiveCaption) };
buffer << L"Hand Preference " << (uiSettings.HandPreference() == HandPreference::RightHanded ? L"right" : L"left") << std::endl;
buffer << L"Cursor Size " << uiSettings.CursorSize().Width << L" x " << uiSettings.CursorSize().Height << std::endl;
buffer << L"Scrollbar Size " << uiSettings.ScrollBarSize().Width << L" x " << uiSettings.ScrollBarSize().Height << std::endl;
buffer << L"Scrollbar Arrow Size " << uiSettings.ScrollBarArrowSize().Width << L" x " << uiSettings.ScrollBarArrowSize().Height << std::endl;
buffer << L"Scrollbar Thumb Box Size " << uiSettings.ScrollBarThumbBoxSize().Width << L" x " << uiSettings.ScrollBarThumbBoxSize().Height << std::endl;
buffer << L"Message Duration " << uiSettings.MessageDuration() << std::endl;
buffer << L"Animations Enabled " << (uiSettings.AnimationsEnabled() ? L"true" : L"false") << std::endl;
buffer << L"Caret Browsing Enabled " << (uiSettings.CaretBrowsingEnabled() ? L"true" : L"false") << std::endl;
buffer << L"Caret Blink Rate " << uiSettings.CaretBlinkRate() << std::endl;
buffer << L"Caret Width " << uiSettings.CaretWidth() << std::endl;
buffer << L"Double Click Time " << uiSettings.DoubleClickTime() << std::endl;
buffer << L"Mouse Hover Time " << uiSettings.MouseHoverTime() << std::endl;
buffer << L"System Colors: " << std::endl;
buffer << L"Active Caption: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::Background);
buffer << L"Background: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::ButtonFace);
buffer << L"Button Face: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::ButtonText);
buffer << L"Button Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::CaptionText);
buffer << L"Caption Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::GrayText);
buffer << L"Gray Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::Highlight);
buffer << L"Highlight: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::HighlightText);
buffer << L"Highlight Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::Hotlight);
buffer << L"Hotlight: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::InactiveCaption);
buffer << L"Inactive Caption: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::InactiveCaptionText);
buffer << L"Inactive Caption Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::Window);
buffer << L"Window: " << color.R << L", " << color.G << L", " << color.B << std::endl;
color = uiSettings.UIElementColor(UIElementType::WindowText);
buffer << L"Window Text: " << color.R << L", " << color.G << L", " << color.B << std::endl;
UIOutputTextBlock().Text(buffer.str().c_str());
}
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;
}
}
Remarks
Version history
Windows version | SDK version | Value added |
---|---|---|
1703 | 15063 | AdvancedEffectsEnabled |
1703 | 15063 | AdvancedEffectsEnabledChanged |
1903 | 18362 | AutoHideScrollBars |
1903 | 18362 | AutoHideScrollBarsChanged |
2004 | 19041 | AnimationsEnabledChanged |
2004 | 19041 | MessageDurationChanged |
Constructors
UISettings() |
Creates a new default instance of the UISettings class. |
Properties
AdvancedEffectsEnabled |
Gets a value that indicates whether the system Transparency effects setting is enabled. |
AnimationsEnabled |
Gets whether animations are enabled for the user interface. |
AutoHideScrollBars |
Gets whether the user has specified that scroll bars should be automatically hidden when not being interacted with. |
CaretBlinkRate |
Gets the blink rate of a new caret created by the app view. |
CaretBrowsingEnabled |
Gets whether the caret can be used for browse operations. |
CaretWidth |
Gets the width of a new caret created by the app view. |
CursorSize |
Gets the size of a new cursor created by the app view. |
DoubleClickTime |
Gets the maximum allowed time between clicks in a double-click operation. |
HandPreference |
Gets the directional preference of the user interface created by the app view. |
MessageDuration |
Gets the length of time a message is displayed for the app view. |
MouseHoverTime |
Gets the amount of time the mouse pointer can rest in a hover rectangle before a hover event is raised. |
ScrollBarArrowSize |
Gets the size of a scroll bar arrow for windows associated with the app view. |
ScrollBarSize |
Gets the size of a scroll bar for windows associated with the app view. |
ScrollBarThumbBoxSize |
Gets the size of a thumb box for windows associated with the app view. |
TextScaleFactor |
Gets the value of the system text size setting. |
Methods
GetColorValue(UIColorType) |
Returns the color value of the specified color type. |
UIElementColor(UIElementType) |
Gets the color used for a specific user interface element type, such as a button face or window text. |
Events
AdvancedEffectsEnabledChanged |
Occurs when the system advanced UI effects setting is enabled or disabled. |
AnimationsEnabledChanged |
Occurs when the value of the AnimationsEnabled property has changed. |
AutoHideScrollBarsChanged |
Event invoked when the AutoHideScrollBars state changes. |
ColorValuesChanged |
Occurs when color values have changed. |
MessageDurationChanged |
Occurs when the value of the MessageDuration property has changed. |
TextScaleFactorChanged |
Occurs when the system text size setting is changed. |