UISettings Class
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
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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;
}
}
Windows version | SDK version | Value added |
---|---|---|
1703 | 15063 | AdvancedEffectsEnabled |
1703 | 15063 | AdvancedEffectsEnabledChanged |
1903 | 18362 | AutoHideScrollBars |
1903 | 18362 | AutoHideScrollBarsChanged |
2004 | 19041 | AnimationsEnabledChanged |
2004 | 19041 | MessageDurationChanged |
UISettings() |
Creates a new default instance of the UISettings class. |
Advanced |
Gets a value that indicates whether the system Transparency effects setting is enabled. |
Animations |
Gets whether animations are enabled for the user interface. |
Auto |
Gets whether the user has specified that scroll bars should be automatically hidden when not being interacted with. |
Caret |
Gets the blink rate of a new caret created by the app view. |
Caret |
Gets whether the caret can be used for browse operations. |
Caret |
Gets the width of a new caret created by the app view. |
Cursor |
Gets the size of a new cursor created by the app view. |
Double |
Gets the maximum allowed time between clicks in a double-click operation. |
Hand |
Gets the directional preference of the user interface created by the app view. |
Message |
Gets the length of time a message is displayed for the app view. |
Mouse |
Gets the amount of time the mouse pointer can rest in a hover rectangle before a hover event is raised. |
Scroll |
Gets the size of a scroll bar arrow for windows associated with the app view. |
Scroll |
Gets the size of a scroll bar for windows associated with the app view. |
Scroll |
Gets the size of a thumb box for windows associated with the app view. |
Text |
Gets the value of the system text size setting. |
Get |
Returns the color value of the specified color type. |
UIElement |
Gets the color used for a specific user interface element type, such as a button face or window text. |
Advanced |
Occurs when the system advanced UI effects setting is enabled or disabled. |
Animations |
Occurs when the value of the AnimationsEnabled property has changed. |
Auto |
Event invoked when the AutoHideScrollBars state changes. |
Color |
Occurs when color values have changed. |
Message |
Occurs when the value of the MessageDuration property has changed. |
Text |
Occurs when the system text size setting is changed. |
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |