Exemple #1
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);
        }
Exemple #2
0
        private static int CoerceStepIndex(StepBar stepBar, int stepIndex)
        {
            int itemsCount = stepBar.Items.OfType <object>().Count();

            if (itemsCount == 0 && stepIndex > 0)
            {
                stepBar._oriStepIndex = stepIndex;
                return(0);
            }

            return(stepIndex < 0
                ? 0
                : stepIndex >= itemsCount
                    ? itemsCount == 0 ? 0 : itemsCount - 1
                    : stepIndex);
        }
Exemple #3
0
 /// <summary>
 /// calls <see cref="OnStepIndexChanged(int)"/>
 /// </summary>
 /// <param name="stepBar"></param>
 /// <param name="e"></param>
 private void OnStepIndexChanged(StepBar stepBar, AvaloniaPropertyChangedEventArgs e)
 {
     stepBar.OnStepIndexChanged((int)e.NewValue);
 }