private void VisualStateGroup_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { if (SettingHelper.DeviceType == DeviceType.PC) { // 之前有Right而之后没有,补充动画 if (e.OldState != Left && e.NewState == Left) { var animation = new PopInThemeAnimation { FromHorizontalOffset = 0, FromVerticalOffset = 100, SpeedRatio = 0.5 }; Storyboard.SetTarget(animation, Lframe); Storyboard storyboard = new Storyboard(); storyboard.Children.Add(animation); storyboard.Begin(); } } }
private void VisualStateGroup_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { var visualState = e.NewState.Name; if (visualState == "NoIndicator") { ///所有内容垂直高度 - 当前滚动的高度 var v1 = Scroller.ExtentHeight - Scroller.VerticalOffset; //可视区域的高度 var v2 = Scroller.ViewportHeight; if (v1 <= v2 + 1) { // TODO: 在此处加载新数据 if (RequestCommand != null && RequestCommand.CanExecute(null)) { RequestCommand.Execute(null); } } } }
private void VisualStateGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { // ensure expected layout when the app is resized if (e.OldState == NarrowState) { FrameMainContentSecond.Navigate(typeof(EditorView)); } if (e.OldState == NarrowState && NavigationViewMain.SelectedItem == null || e.OldState != NarrowState && NavigationViewItemMainEditor.IsSelected) { NavigationViewItemMainScanOptions.IsSelected = true; } if (e.NewState == NarrowState) { TeachingTipTutorialPageList.Target = NavigationViewItemMainPageList; TeachingTipTutorialPageList.PreferredPlacement = WinUI.TeachingTipPlacementMode.Bottom; } if (e.NewState == DefaultState) { TeachingTipTutorialPageList.Target = NavigationViewItemMainPageList; TeachingTipTutorialPageList.PreferredPlacement = WinUI.TeachingTipPlacementMode.Right; } if (e.NewState == WideState) { if (NavigationViewItemMainPageList.IsSelected) { FrameMainContentFirst.Content = null; NavigationViewItemMainScanOptions.IsSelected = true; } FrameMainContentThird.Navigate(typeof(PageListView), null, new SuppressNavigationTransitionInfo()); TeachingTipTutorialPageList.Target = FrameMainContentThird; TeachingTipTutorialPageList.PreferredPlacement = WinUI.TeachingTipPlacementMode.LeftBottom; } }
private void VisualStateGroup_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { var state = VisualStateGroup.CurrentState; if (state == Small) { SmallInteractable(e.OldState); } else if (state == Mid) { MidInteractable(e.OldState); } else if (state == Large) { LargeInteractable(e.OldState); } else if (state == ExtraLarge) { ExtraLargeInteractable(e.OldState); } }
private void OnCurrentStateChanged(object sender, VisualStateChangedEventArgs e) { bool isNarrow = e.NewState == NarrowState; if (isNarrow) { Frame.Navigate(typeof(ApiDetails), selectedContact, new SuppressNavigationTransitionInfo()); } else { VisualStateManager.GoToState(this, MasterDetailsState.Name, true); MasterListView.SelectionMode = ListViewSelectionMode.Extended; MasterListView.SelectedItem = selectedContact; } EntranceNavigationTransitionInfo.SetIsTargetElement(MasterListView, isNarrow); if (DetailContentPresenter != null) { EntranceNavigationTransitionInfo.SetIsTargetElement(DetailContentPresenter, !isNarrow); } }
private void ArrivalBoxVisualStates_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { DoubleAnimation ani = new DoubleAnimation() { To = e.NewState.Name == "ArrivalBoxShown" ? 1 : 0, Duration = TimeSpan.FromSeconds(0.15) }; Storyboard sb = new Storyboard(); Storyboard.SetTarget(ani, StopArrivalBox); Storyboard.SetTargetProperty(ani, "Opacity"); sb.Children.Add(ani); if (e.NewState.Name == "ArrivalBoxShown") { StopArrivalBox.Visibility = Visibility.Visible; } else { ani.Completed += _Ani_Completed; //Done } sb.Begin(); }
void verticalStateGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { //if (e.NewState.Name == "CompressionTop" && CompressionOccured != null) //{ // CompressionOccured(this, new CompressionEventArgs(CompressionType.Top)); //} //else if (e.NewState.Name == "CompressionBottom" && CompressionOccured != null) //{ // CompressionOccured(this, new CompressionEventArgs(CompressionType.Bottom)); //} if (e.NewState.Name == "CompressionTop") { } else if (e.NewState.Name == "CompressionBottom" && CompressionBottomCommand != null) { if (CompressionBottomCommand.CanExecute(null)) { CompressionBottomCommand.Execute(null); } } }
private void OnStateChanged(VisualStateChangedEventArgs args) { switch (args.NewState.Name) { case PanoramicStateName: DisplayMode = SplitViewDisplayMode.CompactInline; break; case WideStateName: DisplayMode = SplitViewDisplayMode.CompactInline; IsPaneOpen = false; break; case NarrowStateName: DisplayMode = SplitViewDisplayMode.Overlay; IsPaneOpen = false; break; default: break; } }
private void NavButton_VisualStateChanged(object sender, VisualStateChangedEventArgs e) { var button = new InfoElement(e.Control); switch (e.NewState.Name) { case "Normal": case "PointerOver": case "Pressed": case "Disabled": case "Checked": case "CheckedPointerOver": case "CheckedPressed": case "CheckedDisabled": case "Indeterminate": case "IndeterminatePointerOver": case "IndeterminatePressed": case "IndeterminateDisabled": default: break; } }
private void WindowStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { switch (e.NewState.Name) { case PanoramicStateName: DisplayMode = SplitViewDisplayMode.CompactInline; break; case WideStateName: DisplayMode = SplitViewDisplayMode.CompactInline; IsPaneOpen = false; break; case NarrowStateName: DisplayMode = SplitViewDisplayMode.Overlay; IsPaneOpen = false; break; default: break; } }
//private DelayedExecutor _de = new DelayedExecutor(300); //internal void PrepareForScrollToBottom() //{ // _notReactToScroll = true; // _savedDelta = DeltaOffset; // // load in the end // DeltaOffset = _scrollViewer.ExtentHeight - _scrollViewer.ViewportHeight - _scrollViewer.VerticalOffset; // Debug.WriteLine("PrepareForScrollToBottom"); // PerformLoadUnload2(VirtualizableState.LoadedPartially, false); // _de.AddToDelayedExecution(() => // { // Execute.ExecuteOnUIThread(() => ScrollToBottomCompleted()); // }); //} //internal void ScrollToBottomCompleted() //{ // _notReactToScroll = false; // DeltaOffset = _savedDelta; // PerformLoadUnload(VirtualizableState.LoadedFully); // Debug.WriteLine("ScrolltoBottomCompleted"); //} private void group_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == "Scrolling") { _isScrolling = true; if (ScrollStateChanged != null) { ScrollStateChanged(this, new ScrollingStateChangedEventArgs(false, true)); } } else { _isScrolling = false; PerformLoadUnload(true); if (ScrollStateChanged != null) { ScrollStateChanged(this, new ScrollingStateChangedEventArgs(true, false)); } } }
private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { // possible states: "CompressionTop", "NoVerticalCompression" Period period; ListBox WorkListBox = null; PanoramaItem pi = FindParentRecursive(sender as FrameworkElement, typeof(PanoramaItem)) as PanoramaItem; if (pi == Day) { period = Period.Day; WorkListBox = PostsDay; } else if (pi == Week) { period = Period.Week; } else if (pi == Month) { period = Period.Month; } else { period = Period.Now; WorkListBox = PostsNow; } if (!busyPicsLoader[(int)period]) { if (e.NewState.Name == "CompressionBottom") { UIElement pb = FindElementRecursive(lastPosts[(int)period] as FrameworkElement, typeof(ProgressBar)); pb.Visibility = Visibility.Visible; busyPicsLoader[(int)period] = true; PData.GetPosts(period); } } }
private void group_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == "Scrolling") { // ISSUE: reference to a compiler-generated field if (this.ScrollStateChanged == null) { return; } // ISSUE: reference to a compiler-generated field this.ScrollStateChanged(this, new ScrollStateChangedEventArgs(true)); } else { // ISSUE: reference to a compiler-generated field if (this.ScrollStateChanged == null) { return; } // ISSUE: reference to a compiler-generated field this.ScrollStateChanged(this, new ScrollStateChangedEventArgs(false)); } }
private void VisualStateGroup_OnCurrentStateChanged(object sender, VisualStateChangedEventArgs e) { if (DeviceInfoHelper.DeviceType == DeviceType.Desktop) { //从RightFrame返回MainShellView,加动画 if (e.OldState == Show123 || e.OldState == Show3) { if (e.NewState == Show12 || e.NewState == Show2) { var animation = new PopInThemeAnimation { FromHorizontalOffset = 0, FromVerticalOffset = 100, SpeedRatio = 0.5, }; Storyboard.SetTarget(animation, centerPanel); var sb = new Storyboard(); sb.Children.Add(animation); sb.Begin(); } } } }
public CategoryUserControl() { this.InitializeComponent(); DataContextChanged += (s, e) => { Bindings.Update(); if (Item?.images != null) { FindName(nameof(SmallImageControl)); } //if (Item == null) return; //IconBox.Children.Add(Resources["AndroidIcon"] as Path); }; Loaded += (s, e) => { var args = new VisualStateChangedEventArgs { NewState = AdaptiveVisualStateGroup.CurrentState, }; AdaptiveVisualStateGroup_CurrentStateChanged(this, args); }; }
private void VerticalGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == CompressionTopState) { IsBouncy = true; if (Compression != null) { Compression(this, new CompressionEventArgs(CompressionType.Top)); } } if (e.NewState.Name == CompressionBottomState) { IsBouncy = true; if (Compression != null) { Compression(this, new CompressionEventArgs(CompressionType.Bottom)); } } if (e.NewState.Name == NoVerticalCompressionState) { IsBouncy = false; } }
private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (Visibility == System.Windows.Visibility.Collapsed) { return; } if (e.NewState.Name == "CompressionTop" && StretchToDetect == StretchDirections.Top) { wasStretched = true; Debug.WriteLine("CompressionTop"); VisualStateManager.GoToState(this, PullToRefreshPanel.PullingDownVisualState, false); Observable.Delay(Observable.Return <int>(1), TimeSpan.FromMilliseconds(StretchDelay)).ObserveOnDispatcher().Subscribe ( onNext => ReadyToRelease() ); } if (e.NewState.Name == "CompressionBottom" && StretchToDetect == StretchDirections.Bottom) { wasStretched = true; Debug.WriteLine("CompressionBottom"); VisualStateManager.GoToState(this, PullToRefreshPanel.PullingDownVisualState, false); Observable.Delay(Observable.Return <int>(1), TimeSpan.FromMilliseconds(StretchDelay)).ObserveOnDispatcher().Subscribe ( onNext => ReadyToRelease() ); } if (e.NewState.Name == "NoVerticalCompression" && (StretchToDetect == StretchDirections.Top || StretchToDetect == StretchDirections.Bottom)) { wasStretched = false; Debug.WriteLine("NoVerticalCompression"); VisualStateManager.GoToState(this, PullToRefreshPanel.InactiveVisualState, false); } }
private void Common_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (_previewStates.Contains(e.NewState.Name) && (e.OldState == null || !_previewStates.Contains(e.OldState.Name))) { var vis = this.GetElementVisual(); vis.Clip.StartAnimation( vis.CreateScalarKeyFrameAnimation(nameof(InsetClip.RightInset)) .AddKeyFrame(1, 0) .SetDuration(0.4) .SetParameter("Parent", vis) .SetParameter("Child", _iconPresenter.GetElementVisual())); } else if (!_previewStates.Contains(e.NewState.Name) && (_previewStates.Contains(e.OldState.Name))) { var vis = this.GetElementVisual(); vis.Clip.StartAnimation( vis.CreateScalarKeyFrameAnimation(nameof(InsetClip.RightInset)) .AddKeyFrame(1, "Parent.Size.X - Child.Size.X") .SetParameter("Parent", this.GetElementVisual()) .SetParameter("Child", _iconPresenter.GetElementVisual())); } }
private void HorizontalGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == CompressionLeftState) { IsBouncy = true; if (Compression != null) { Compression(this, new CompressionEventArgs(CompressionType.Left)); } } if (e.NewState.Name == CompressionRightState) { IsBouncy = true; if (Compression != null) { Compression(this, new CompressionEventArgs(CompressionType.Right)); } } if (e.NewState.Name == NoHorizontalCompressionState) { IsBouncy = false; } }
private void VisualStateGroup_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) => SetNavigationViewHeaderTemplate();
/// <summary> /// Actually closes the popup after the VSM state animation completes. /// </summary> /// <param name="sender">Event source.</param> /// <param name="e">Event arguments.</param> private void OnPopupClosedStateChanged(object sender, VisualStateChangedEventArgs e) { // Delayed closing of the popup until now if(e != null && e.NewState != null && e.NewState.Name == VisualStates.StatePopupClosed) { if(Popup != null) { Popup.IsOpen = false; } OnClosed(EventArgs.Empty); } }
private void ProgressBarPage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { VisualStateText.Text = e.NewState.Name; }
private void ScrollingStateChanging(object sender, VisualStateChangedEventArgs e) { IsScrolling = e.NewState.Name == "Scrolling"; }
/// <summary> /// Fires when the addaptive trigger changes state. /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event args</param> /// <remarks> /// Handles showing/hiding the back button when the state changes /// </remarks> private void OnVisualStateChanged(object sender, VisualStateChangedEventArgs e) { UpdateView(false); }
private void ScrollStateGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { IsScrolling = (e.NewState.Name == ScrollingState); }
private void ToastOnClosed(object sender, VisualStateChangedEventArgs visualStateChangedEventArgs) { Toast2.Closed -= ToastOnClosed; ToastEventBtn.Content = "toast event"; ToastEventBtn.IsEnabled = true; }
private void WindowStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) => GoToState(e.NewState.Name);
private void AdaptiveStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { Debug.WriteLine("state changed"); }
private void AdaptiveStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { UpdateForVisualState(e.NewState, e.OldState); }
private void AdaptiveStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { }
void groupReveal_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { switch (e.NewState.Name) { case StateRevealShown: if (State == DataPointState.Showing) { State = DataPointState.Normal; } break; case StateRevealHidden: if (State == DataPointState.Hiding) { State = DataPointState.Hidden; } break; } }
private void CommonStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { Debug.WriteLine(e.OldState?.Name + " to " + e.NewState.Name); }
private void MainPage_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) { UpdateViewModelState(e.NewState); }
/// <summary> /// Provides handling for the ExpansionStates CurrentChanged event. /// </summary> /// <param name="sender">The ExpansionState VisualStateGroup.</param> /// <param name="e">Event arguments.</param> private void OnExpansionStateGroupStateChanged(object sender, VisualStateChangedEventArgs e) { // Only listen for the Expanded state if (string.Compare(e.NewState.Name, VisualStates.StateExpanded, StringComparison.OrdinalIgnoreCase) != 0) { return; } BringIntoView(); }
/// <summary> /// Actually closes the popup after the VSM state animation completes. /// </summary> /// <param name="sender">Event source.</param> /// <param name="e">Event arguments.</param> private void OnPopupClosedStateChanged(object sender, VisualStateChangedEventArgs e) { // validate if (e == null || e.NewState == null) { return; } switch (e.NewState.Name) { // Delayed closing of the popup until now case VisualStates.StatePopupClosed: CloseDropDown(true, false); break; default: break; } }