private void UpdateActiveState() { PseudoClasses.Remove(PseudoClass_Inactive); PseudoClasses.Remove(PseudoClass_Active); Action action; PseudoClasses.Set(PseudoClass_Active, IsActive); PseudoClasses.Set(PseudoClass_Inactive, IsActive == false); //if (IsActive) //{ /*action = () =>*/ // this.PseudoClasses.Add(PseudoClass_Active); //} //else ///*action = () =>*/ //{ // this.PseudoClasses.Add(PseudoClass_Inactive); //} //if (_deferredActions != null) // _deferredActions.Add(action); //else // action(); }
internal void SelectSingleItem(object item) { if (SelectedItem != item) { PseudoClasses.Remove(":normal"); PseudoClasses.Add(":normal"); } (SelectedItem as ISelectable).IsSelected = false; SelectedItems.Clear(); SelectedItems.Add(item); (item as ISelectable).IsSelected = true; var item_parents = (item as ILogical).GetLogicalAncestors().OfType <NavigationViewItem>(); foreach (NavigationViewItem n in item_parents) { n.IsExpanded = true; } Debug.WriteLine($"{item_parents.Count()}"); SelectedItem = item; //Sets the items of AutoCompleteBox }
protected override void OnSelectionChanged(object sender, AvaloniaPropertyChangedEventArgs e) { base.OnSelectionChanged(sender, e); PseudoClasses.Remove(":normal"); PseudoClasses.Add(":normal"); }
private void UpdatePseudoClasses() { PseudoClasses.Remove(PseudoClass_Active); PseudoClasses.Remove(PseudoClass_Inactive); PseudoClasses.Add(IsActive ? PseudoClass_Active : PseudoClass_Inactive); }
protected virtual void OnDragLeave(object sender, RoutedEventArgs e) { if (Parent is AuraTabView atw && atw.ImmediateDrag) { PseudoClasses.Remove(":dragging"); } }
protected virtual void OnDrop(object sender, DragEventArgs e) { PseudoClasses.Remove(":dragging"); if (true) //TODO: check if theirs parent are the same { ItemsControlOperations.MoveItemOnDrop <AuraTabView, AuraTabItem>( sender, e, (view, src, item) => { int h = (view.Items as IList).IndexOf(item); item.PseudoClasses.Remove(":dragging"); view.lastselectindex = view.SelectedIndex; view.SelectedIndex = h; view.SelectedItem = (view.Items as IList)[view.SelectedIndex]; var it = view.Items as IList <AuraTabItem>; }); Debug.WriteLine("Drag completed"); Debug.WriteLine($"Selected Index: {this.GetParentTOfLogical<AuraTabView>().SelectedIndex}"); Debug.WriteLine($"Tab Index: {(this.GetParentTOfLogical<AuraTabView>().Items as IList).IndexOf(this)}"); } }
internal void SelectSingleItemCore(object item) { if (SelectedItem != item) { PseudoClasses.Remove(":normal"); PseudoClasses.Add(":normal"); } if (SelectedItem is not null) { (SelectedItem as ISelectable).IsSelected = false; } (item as ISelectable).IsSelected = true; SelectedItems.Clear(); SelectedItems.Add(item); var item_parents = (item as ILogical).GetLogicalAncestors().OfType <NavigationViewItem>(); if (this.IsOpen) { foreach (NavigationViewItem n in item_parents) { n.IsExpanded = true; } } // Debug.WriteLine($"{item_parents.Count()}"); SelectedItem = item; }
public void Pause() { if (soundStream != null) { soundStream.Play(); } PseudoClasses.Remove(":playing"); PseudoClasses.Add(":paused"); }
protected void OnCanDraggablePropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e) { if (CanBeDragged == true) { PseudoClasses.Add(":lockdrag"); } else if (CanBeDragged == false) { PseudoClasses.Remove(":lockdrag"); } }
/// <summary> /// Initializes a new instance of the <see cref="ScrollThumb"/> class. /// </summary> public ScrollThumb() : base() { GetScrollState().State.Subscribe(s => { if (!s) { lastPoint = null; PseudoClasses.Remove(":pressed"); } }); }
/// <inheritdoc/> protected override void OnPointerReleased(PointerReleasedEventArgs e) { base.OnPointerReleased(e); e.Device.Capture(null); PseudoClasses.Remove(":pressed"); e.Handled = true; if (ClickMode == ClickMode.Release && new Rect(Bounds.Size).Contains(e.GetPosition(this))) { RaiseClickEvent(); } }
private void UpdatePseudoClasses(bool isOpen) { if (isOpen) { PseudoClasses.Remove(":closed"); PseudoClasses.Add(":opened"); } else { PseudoClasses.Remove(":opened"); PseudoClasses.Add(":closed"); } }
/// <inheritdoc/> protected override void OnPointerReleased(PointerEventArgs e) { base.OnPointerReleased(e); e.Device.Capture(null); PseudoClasses.Remove(":pressed"); e.Handled = true; if (ClickMode == ClickMode.Release && Classes.Contains(":pointerover")) { RaiseClickEvent(); } }
private void UpdatePseudoClasses(bool isCompact) { switch (isCompact) { case true: PseudoClasses.Add(":compact"); break; case false: PseudoClasses.Remove("compact"); break; } }
/// <inheritdoc/> protected override void OnPointerReleased(PointerReleasedEventArgs e) { base.OnPointerReleased(e); if (LinkTo != null & e.InitialPressMouseButton == MouseButton.Left) { var parent = this.GetParentTOfVisual <NavigationView>(); if (parent != null & this.PointerEffectivelyOver(e)) { parent.SelectSingleItem(LinkTo); } } PseudoClasses.Remove(":pressed"); }
protected virtual void OnClosed(object sender, RoutedEventArgs e) { PseudoClasses.Remove(":opened"); PseudoClasses.Add(":closed"); /*if (this.GetParentTOfLogical<Control>() is SuperNavigationView) * { * return; * } * else if(this.GetParentTOfLogical<Control>() is SuperNavigationViewItem s) * { * var p = this.GetParentTOfLogical<SuperNavigationView>(); * * s.IsSelected = true; * p.SelectedItem = s; * }*/ }
private void ToggleWindowState() { switch (WindowState) { case WindowState.Maximized: WindowState = WindowState.Normal; //Restore to normal size PseudoClasses.Remove(":maximized"); break; case WindowState.Normal: WindowState = WindowState.Maximized; //TODO: Make this not fullscreen //Maximize the window PseudoClasses.Add(":maximized"); break; } }
protected override void OnPointerReleased(PointerReleasedEventArgs e) { if (_lastPoint.HasValue) { e.Handled = true; _lastPoint = null; var ev = new VectorEventArgs { RoutedEvent = DragCompletedEvent, Vector = (Vector)e.GetPosition(this), }; RaiseEvent(ev); } PseudoClasses.Remove(":pressed"); }
private void UpdateLargeState() { PseudoClasses.Remove(PseudoClass_Large); PseudoClasses.Remove(PseudoClass_Small); Action action; PseudoClasses.Set(PseudoClass_Large, IsLarge); PseudoClasses.Set(PseudoClass_Small, IsLarge == false); //if (IsLarge) // /*action = () =>*/ this.PseudoClasses.Add(PseudoClass_Large); //else // /*action = () =>*/ this.PseudoClasses.Add(PseudoClass_Small); //if (_deferredActions != null) // _deferredActions.Add(action); //else // action(); }
protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) { if (_lastPoint.HasValue) { var ev = new VectorEventArgs { RoutedEvent = DragCompletedEvent, Vector = _lastPoint.Value, }; _lastPoint = null; RaiseEvent(ev); } PseudoClasses.Remove(":pressed"); base.OnPointerCaptureLost(e); }
private void TransportItem(object sender, DragEventArgs e) { PseudoClasses.Remove(":dragging"); ItemsControlOperations.MoveItemOnDrop <AuraTabView, AuraTabItem>( sender, e, (view, src, item) => { int h = (view.Items as IList).IndexOf(item); item.PseudoClasses.Remove(":dragging"); view.lastselectindex = view.SelectedIndex; view.SelectedIndex = h; view.SelectedItem = (view.Items as IList)[view.SelectedIndex]; var it = view.Items as IList <AuraTabItem>; }); //Debug.WriteLine("Drag completed"); //Debug.WriteLine($"Selected Index: {this.GetParentTOfLogical<AuraTabView>().SelectedIndex}"); //Debug.WriteLine($"Tab Index: {(this.GetParentTOfLogical<AuraTabView>().Items as IList).IndexOf(this)}"); }
/// <inheritdoc/> protected override void OnPointerReleased(PointerReleasedEventArgs e) { base.OnPointerReleased(e); PseudoClasses.Remove(":dragging"); }
protected virtual void OnDragLeave(object sender, RoutedEventArgs e) { PseudoClasses.Remove(":dragging"); }
protected override IEnumerable <CGeometry> MeasureOverride( double entireWidth, double remainWidth) { var metrics = base.MeasureOverride( entireWidth, remainWidth); foreach (CGeometry metry in metrics) { metry.OnClick = () => Command?.Invoke(CommandParameter); metry.OnMousePressed = () => { PseudoClasses.Add(":pressed"); }; metry.OnMouseReleased = () => { PseudoClasses.Remove(":pressed"); }; metry.OnMouseEnter = () => { PseudoClasses.Add(":pointerover"); PseudoClasses.Add(":hover"); IEnumerable <TextGeometry> tmetries = (metry is DecoratorGeometry d) ? d.Targets.OfType <TextGeometry>() : (metry is TextGeometry t) ? new[] { t } : new TextGeometry[0]; if (tmetries != null) { foreach (var tmetry in tmetries) { tmetry.TemporaryForeground = HoverForeground; tmetry.TemporaryBackground = HoverBackground; } RequestRender(); } }; metry.OnMouseLeave = () => { PseudoClasses.Remove(":pointerover"); PseudoClasses.Remove(":hover"); IEnumerable <TextGeometry> tmetries = (metry is DecoratorGeometry d) ? d.Targets.OfType <TextGeometry>() : (metry is TextGeometry t) ? new[] { t } : new TextGeometry[0]; if (tmetries != null) { foreach (var tmetry in tmetries) { tmetry.TemporaryForeground = null; tmetry.TemporaryBackground = null; } RequestRender(); } }; yield return(metry); } }
protected virtual void OnClosed(object sender, RoutedEventArgs e) { PseudoClasses.Remove(":opened"); PseudoClasses.Add(":closed"); }
internal void RemovePseudoClasses(string name) { PseudoClasses.Remove(name); }
/// <inheritdoc/> protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) { base.OnPointerCaptureLost(e); PseudoClasses.Remove(":dragging"); }
/// <inheritdoc/> protected override void OnLostFocus(RoutedEventArgs e) { base.OnLostFocus(e); PseudoClasses.Remove(":dragging"); }
/// <inheritdoc/> protected override void OnPointerLeave(PointerEventArgs e) { base.OnPointerLeave(e); PseudoClasses.Remove(":dragging"); }