protected override void OnSelectionChanged(object sender, AvaloniaPropertyChangedEventArgs e) { base.OnSelectionChanged(sender, e); PseudoClasses.Remove(":normal"); PseudoClasses.Add(":normal"); }
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) { base.OnAttachedToVisualTree(e); _grid = this.GetVisualParent <Grid>(); _orientation = DetectOrientation(); int defenitionIndex; //row or col if (_orientation == Orientation.Vertical) { Cursor = new Cursor(StandardCursorType.SizeWestEast); _definitions = _grid.ColumnDefinitions.Cast <DefinitionBase>().ToList(); defenitionIndex = GetValue(Grid.ColumnProperty); PseudoClasses.Add(":vertical"); } else { Cursor = new Cursor(StandardCursorType.SizeNorthSouth); defenitionIndex = GetValue(Grid.RowProperty); _definitions = _grid.RowDefinitions.Cast <DefinitionBase>().ToList(); PseudoClasses.Add(":horizontal"); } if (defenitionIndex > 0) { _prevDefinition = _definitions[defenitionIndex - 1]; } if (defenitionIndex < _definitions.Count - 1) { _nextDefinition = _definitions[defenitionIndex + 1]; } }
protected virtual void OnDragStarted(object sender, DragEventArgs e) { if (Parent is AuraTabView atw && !atw.ImmediateDrag) { PseudoClasses.Add(":dragging"); } }
public SplitView() { PseudoClasses.Add(":overlay"); PseudoClasses.Add(":left"); TemplateSettings = new SplitViewTemplateSettings(); }
/// <summary> /// adds the pseudo class by <see cref="StepBar.Dock"/> property /// </summary> /// <param name="context"></param> public override void Render(DrawingContext context) { StepBar stepBar = Parent as StepBar; Dock currentDock = stepBar.Dock; if (_lastDock == null || _lastDock.Value != currentDock) { pseudoClassesToClear.ForEach(x => Classes.Remove(x)); switch (currentDock) { case Dock.Top: PseudoClasses.Add(StepBar_Dock_Top_Class); break; case Dock.Left: PseudoClasses.Add(StepBar_Dock_Left_Class); break; case Dock.Bottom: PseudoClasses.Add(StepBar_Dock_Bottom_Class); break; case Dock.Right: PseudoClasses.Add(StepBar_Dock_Right_Class); break; } _lastDock = currentDock; } base.Render(context); }
private void UpdatePseudoClasses() { PseudoClasses.Remove(PseudoClass_Active); PseudoClasses.Remove(PseudoClass_Inactive); PseudoClasses.Add(IsActive ? PseudoClass_Active : PseudoClass_Inactive); }
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 }
private void HeaderChanged(AvaloniaPropertyChangedEventArgs e) { if (e.NewValue is string newValue && newValue == "-") { PseudoClasses.Add(":separator"); Focusable = false; }
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 NavigationView() { PseudoClasses.Add(":normal"); this.GetObservable(BoundsProperty).Subscribe(async(bounds) => { OnBoundsChanged(bounds); }); }
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"); } }
private void UpdatePseudoClasses(bool isCompact) { switch (isCompact) { case true: PseudoClasses.Add(":compact"); break; case false: PseudoClasses.Remove("compact"); break; } }
private void UpdatePseudoClasses(bool isOpen) { if (isOpen) { PseudoClasses.Remove(":closed"); PseudoClasses.Add(":opened"); } else { PseudoClasses.Remove(":opened"); PseudoClasses.Add(":closed"); } }
/// <inheritdoc/> protected override void OnPointerPressed(PointerPressEventArgs e) { base.OnPointerPressed(e); PseudoClasses.Add(":pressed"); e.Device.Capture(this); e.Handled = true; if (ClickMode == ClickMode.Press) { RaiseClickEvent(); } }
protected override void OnPointerPressed(PointerPressedEventArgs e) { e.Handled = true; _lastPoint = e.GetPosition(this); var ev = new VectorEventArgs { RoutedEvent = DragStartedEvent, Vector = (Vector)_lastPoint, }; PseudoClasses.Add(":pressed"); RaiseEvent(ev); }
public ExtendedTitleBar() { if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { PseudoClasses.Add(":macos"); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { PseudoClasses.Add(":windows"); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { PseudoClasses.Add(":linux"); } }
private void UpdateHeightOrWidth() { if (IsHorizontal) { Height = Thickness; Width = double.NaN; Cursor = new Cursor(StandardCursorType.SizeNorthSouth); PseudoClasses.Add(":horizontal"); } else { Width = Thickness; Height = double.NaN; Cursor = new Cursor(StandardCursorType.SizeWestEast); PseudoClasses.Add(":vertical"); } }
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; } }
/// <summary> /// Initializes a new instance of the <see cref="NotificationCard"/> class. /// </summary> public NotificationCard() { this.GetObservable(IsClosedProperty) .Subscribe(x => { if (!IsClosing && !IsClosed) { return; } RaiseEvent(new RoutedEventArgs(NotificationClosedEvent)); }); // Disabling nullable checking because of https://github.com/dotnet/reactive/issues/1525 #pragma warning disable CS8620 this.GetObservable(ContentProperty) .OfType <Notification>() #pragma warning restore CS8620 .Subscribe(x => { switch (x.Type) { case NotificationType.Error: PseudoClasses.Add(":error"); break; case NotificationType.Information: PseudoClasses.Add(":information"); break; case NotificationType.Success: PseudoClasses.Add(":success"); break; case NotificationType.Warning: PseudoClasses.Add(":warning"); break; } }); }
/// <summary> /// Initializes a new instance of the <see cref="NotificationCard"/> class. /// </summary> public NotificationCard() { this.GetObservable(IsClosedProperty) .Subscribe(x => { if (!IsClosing && !IsClosed) { return; } RaiseEvent(new RoutedEventArgs(NotificationClosedEvent)); }); this.GetObservable(ContentProperty) .OfType <Notification>() .Subscribe(x => { switch (x.Type) { case NotificationType.Error: PseudoClasses.Add(":error"); break; case NotificationType.Information: PseudoClasses.Add(":information"); break; case NotificationType.Success: PseudoClasses.Add(":success"); break; case NotificationType.Warning: PseudoClasses.Add(":warning"); break; } }); }
public NavigationView() { PseudoClasses.Add(":normal"); }
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"); }
/// <inheritdoc/> protected override void OnPointerPressed(PointerPressedEventArgs e) { base.OnPointerPressed(e); PseudoClasses.Add(":pressed"); }
/// <summary> /// Initializes a new instance of the <see cref="ItemsControl"/> class. /// </summary> public ItemsControl() { PseudoClasses.Add(":empty"); SubscribeToItems(_items); }
/// <summary> /// add MouseOverBorderBrush changed handler /// </summary> public Tile() { PseudoClasses.Add(PseudoClassIsNullMouseOverBorderBrush); MouseOverBorderBrushProperty.Changed.AddClassHandler <Tile>((o, e) => OnMouseOverBorderBrushChanged(o, e)); }
/// <summary> /// Initializes a new instance of the <see cref="ItemsControl"/> class. /// </summary> public ItemsControl() { PseudoClasses.Add(":empty"); SubscribeToItems(_items); ItemTemplateProperty.Changed.AddClassHandler <ItemsControl>(x => x.ItemTemplateChanged); }
public ContentDialog() { PseudoClasses.Add(":hidden"); }