Пример #1
0
        private static void CalculateCurrentSentenceHighlight(ShowProgress ctrl, int highlightedIndex)
        {
            var space = (int)(ctrl.ActualWidth / (ctrl.Sentences.Count + 1));
            var newX = (space + 5) * (highlightedIndex + 1);

            var move = new DoubleAnimation()
                                {
                                    To = (int)newX,
                                    Duration = TimeSpan.FromMilliseconds(400),
                                    EasingFunction = new CircleEase() { EasingMode = EasingMode.EaseInOut }
                                };

            Storyboard.SetTarget(move, ctrl.currentProgressIndicator);
            Storyboard.SetTargetProperty(move, "(UIElement.RenderTransform).(CompositeTransform.TranslateX)");

            Storyboard b = new Storyboard();
            b.Children.Add(move);
            b.Begin();

            //ctrl.CurrentTickMargin = new Thickness((int)newX , 0, 0, 0);
        }
Пример #2
0
 private static void CalculateTicksSpace(ShowProgress ctrl, ObservableCollection<Sentence> sentences)
 {
     if (sentences.Count > 0)
     {
         ctrl.TickMargin = new Thickness((int)(ctrl.ActualWidth / (sentences.Count + 1)), 0, 0, 0);
         CalculateCurrentSentenceHighlight(ctrl, ctrl.CurrentIndex);
     }
 }