예제 #1
0
        protected override void OnSelectionChanged(object sender, AvaloniaPropertyChangedEventArgs e)
        {
            base.OnSelectionChanged(sender, e);

            PseudoClasses.Remove(":normal");
            PseudoClasses.Add(":normal");
        }
예제 #2
0
        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];
            }
        }
예제 #3
0
 protected virtual void OnDragStarted(object sender, DragEventArgs e)
 {
     if (Parent is AuraTabView atw && !atw.ImmediateDrag)
     {
         PseudoClasses.Add(":dragging");
     }
 }
예제 #4
0
        public SplitView()
        {
            PseudoClasses.Add(":overlay");
            PseudoClasses.Add(":left");

            TemplateSettings = new SplitViewTemplateSettings();
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        private void UpdatePseudoClasses()
        {
            PseudoClasses.Remove(PseudoClass_Active);
            PseudoClasses.Remove(PseudoClass_Inactive);

            PseudoClasses.Add(IsActive ? PseudoClass_Active : PseudoClass_Inactive);
        }
예제 #7
0
        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
        }
예제 #8
0
 private void HeaderChanged(AvaloniaPropertyChangedEventArgs e)
 {
     if (e.NewValue is string newValue && newValue == "-")
     {
         PseudoClasses.Add(":separator");
         Focusable = false;
     }
예제 #9
0
        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;
        }
예제 #10
0
 public NavigationView()
 {
     PseudoClasses.Add(":normal");
     this.GetObservable(BoundsProperty).Subscribe(async(bounds) =>
     {
         OnBoundsChanged(bounds);
     });
 }
예제 #11
0
        public void Pause()
        {
            if (soundStream != null)
            {
                soundStream.Play();
            }

            PseudoClasses.Remove(":playing");
            PseudoClasses.Add(":paused");
        }
예제 #12
0
 protected void OnCanDraggablePropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
 {
     if (CanBeDragged == true)
     {
         PseudoClasses.Add(":lockdrag");
     }
     else if (CanBeDragged == false)
     {
         PseudoClasses.Remove(":lockdrag");
     }
 }
예제 #13
0
        private void UpdatePseudoClasses(bool isCompact)
        {
            switch (isCompact)
            {
            case true:
                PseudoClasses.Add(":compact");
                break;

            case false:
                PseudoClasses.Remove("compact");
                break;
            }
        }
예제 #14
0
 private void UpdatePseudoClasses(bool isOpen)
 {
     if (isOpen)
     {
         PseudoClasses.Remove(":closed");
         PseudoClasses.Add(":opened");
     }
     else
     {
         PseudoClasses.Remove(":opened");
         PseudoClasses.Add(":closed");
     }
 }
예제 #15
0
        /// <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();
            }
        }
예제 #16
0
        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);
        }
예제 #17
0
 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");
     }
 }
예제 #18
0
 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");
     }
 }
예제 #19
0
        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;
             * }*/
        }
예제 #20
0
        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;
            }
        }
예제 #21
0
        /// <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;
                }
            });
        }
예제 #22
0
        /// <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;
                }
            });
        }
예제 #23
0
 public NavigationView()
 {
     PseudoClasses.Add(":normal");
 }
예제 #24
0
        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);
            }
        }
예제 #25
0
 protected virtual void OnClosed(object sender, RoutedEventArgs e)
 {
     PseudoClasses.Remove(":opened");
     PseudoClasses.Add(":closed");
 }
예제 #26
0
 /// <inheritdoc/>
 protected override void OnPointerPressed(PointerPressedEventArgs e)
 {
     base.OnPointerPressed(e);
     PseudoClasses.Add(":pressed");
 }
예제 #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemsControl"/> class.
 /// </summary>
 public ItemsControl()
 {
     PseudoClasses.Add(":empty");
     SubscribeToItems(_items);
 }
예제 #28
0
 /// <summary>
 /// add MouseOverBorderBrush changed handler
 /// </summary>
 public Tile()
 {
     PseudoClasses.Add(PseudoClassIsNullMouseOverBorderBrush);
     MouseOverBorderBrushProperty.Changed.AddClassHandler <Tile>((o, e) => OnMouseOverBorderBrushChanged(o, e));
 }
예제 #29
0
 /// <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);
 }
예제 #30
0
 public ContentDialog()
 {
     PseudoClasses.Add(":hidden");
 }