public MainPage() { this.InitializeComponent(); uwu = new UserInteractionMode(); uwu.DesktopTabletModeEvent += Uwu_TabletModeEvent; var lol = uwu.GetSlateState(); }
// this is called when switching to tablet mode private async void MainPage_SizeChanged(CoreWindow sender, WindowSizeChangedEventArgs args) { var viewSettings = UIViewSettings.GetForCurrentView(); if (viewSettings.UserInteractionMode == UserInteractionMode.Touch && _currentUserInteractionMode == UserInteractionMode.Mouse) { await HidePreviewWindowAsync(false); PreviewPopup.IsOpen = true; } _currentUserInteractionMode = viewSettings.UserInteractionMode; }
public MainPage() { var viewSettings = UIViewSettings.GetForCurrentView(); _currentUserInteractionMode = viewSettings.UserInteractionMode; this.InitializeComponent(); CoreWindow.GetForCurrentThread().SizeChanged += MainPage_SizeChanged; PreviewPopupContents.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY; PreviewPopupContents.ManipulationStarted += PreviewPopup_ManipulationStarted; PreviewPopupContents.ManipulationDelta += PreviewPopup_ManipulationDelta; PreviewPopupContents.ManipulationCompleted += PreviewPopup_ManipulationCompleted; ApplicationView.GetForCurrentView().Title = "Main View"; this.Loaded += MainPage_Loaded; }
/// <summary> /// /// </summary> /// <returns></returns> public static InteractionCapability GetForCurrentView() { InteractionCapability retVal; UserInteractionMode interactionMode = UIViewSettings.GetForCurrentView().UserInteractionMode; if (DeviceFamily == DeviceFamily.Team) { retVal = InteractionCapability.MultiUserMultitouch; } else if (DeviceFamily == DeviceFamily.Desktop && interactionMode == UserInteractionMode.Mouse) { retVal = InteractionCapability.MouseAndKeyboard; } else { retVal = InteractionCapability.SingleUserMultitouch; } return(retVal); }
/// <summary> /// 切换滑块样式 /// </summary> /// <param name="mode"></param> private void ChangeStyle(UserInteractionMode mode) { if (!IsSupportTouchMode) return; // 如果不支持触摸直接返回 string resource = ""; if (mode == UserInteractionMode.Touch) { resource = "VerticalThumbStyle"; _indicatorMode = ScrollingIndicatorMode.TouchIndicator; OnPointerOver(false, false, true); } else { resource = "DefaultVerticalThumbStyle"; _indicatorMode = ScrollingIndicatorMode.MouseIndicator; } if (_verticalThumb == null) return; Style style = this.Resources[resource] as Style; if (_verticalThumb.Style != style) _verticalThumb.Style = style; }
private void UpdateTrigger(UserInteractionMode interactionMode) { IsActive = interactionMode == UIViewSettings.GetForCurrentView().UserInteractionMode; }