UIViewSettings 클래스

정의

디바이스 모드(태블릿 또는 데스크톱) 및 입력 디바이스 유형과 관련된 UI 상태 및 동작을 나타냅니다.

public ref class UIViewSettings sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class UIViewSettings final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class UIViewSettings
Public NotInheritable Class UIViewSettings
상속
Object Platform::Object IInspectable UIViewSettings
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

여기서는 사용자 상호 작용 모드를 검색하고 응답하는 방법을 보여 드립니다.

using System.ComponentModel;
using Windows.UI.Core;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace SDKTemplate
{
    public sealed partial class Scenario1_Basic : Page, INotifyPropertyChanged
    {
        private MainPage rootPage;

        public Scenario1_Basic()
        {
            this.InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            rootPage = MainPage.Current;

            // The SizeChanged event is raised when the
            // user interaction mode changes.
            Window.Current.SizeChanged += OnWindowResize;
            UpdateContent();
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            Window.Current.SizeChanged -= OnWindowResize;
        }

        void OnWindowResize(object sender, WindowSizeChangedEventArgs e)
        {
            UpdateContent();
        }

        public event PropertyChangedEventHandler PropertyChanged;

        #region InteractionMode data binding
        private UserInteractionMode interactionMode;

        public UserInteractionMode InteractionMode
        {
            get { return interactionMode; }
            set
            {
                if (interactionMode != value)
                {
                    interactionMode = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, 
                            new PropertyChangedEventArgs("InteractionMode"));
                    }
                }
            }
        }

        #region CheckBoxStyle data binding
        private Style checkBoxStyle;

        public Style CheckBoxStyle
        {
            get { return checkBoxStyle; }
            set
            {
                if (checkBoxStyle != value)
                {
                    checkBoxStyle = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, 
                            new PropertyChangedEventArgs("CheckBoxStyle"));
                    }
                }
            }
        }

        void UpdateContent()
        {
            InteractionMode = 
                UIViewSettings.GetForCurrentView().UserInteractionMode;

            // Update styles
            CheckBoxStyle = 
                InteractionMode == 
                    UserInteractionMode.Mouse ? 
                        MouseCheckBoxStyle : TouchCheckBoxStyle;
        }
    }
}

설명

이 클래스의 instance 얻으려면 GetForCurrentView를 호출합니다.

태블릿 모드(Windows 10만 해당)

참고

Windows 11 태블릿 모드가 제거되고 키보드 연결 및 분리 태세에 대한 새로운 기능이 포함됩니다.

일부 장치(PC, 노트북, 태블릿)는 데스크톱 및 태블릿 모드를 모두 지원합니다.

Windows 10 경우에만 사용자는 설정 시스템 > 태블릿 모드로 이동하고 >장치를 태블릿으로 사용할 때 Windows를 더 터치 친화적으로 설정하여 태블릿 모드와 데스크톱 모드에서 실행 중으로 전환할 수 있습니다.

속성

UserInteractionMode

디바이스 UI가 터치 입력 또는 마우스 입력에 최적화되어 있는지 여부를 나타내는 값을 가져옵니다.

메서드

GetForCurrentView()

활성 앱의 디바이스 모드(태블릿 또는 데스크톱)와 연결된 UI 상태 및 동작을 가져옵니다.

태블릿 모드(Windows 10만 해당)

참고

Windows 11 태블릿 모드가 제거되고 키보드 연결 및 분리 태세에 대한 새로운 기능이 포함됩니다.

일부 장치(PC, 노트북, 태블릿)는 데스크톱 및 태블릿 모드를 모두 지원합니다.

Windows 10 경우에만 사용자는 설정 시스템 > 태블릿 모드로 이동하고 >장치를 태블릿으로 사용할 때 Windows를 더 터치 친화적으로 설정하여 태블릿 모드와 데스크톱 모드에서 실행 중으로 전환할 수 있습니다.

적용 대상

추가 정보