예제 #1
0
        public static void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomProgressBar progress  = sender as CustomProgressBar;
            TextBlock         textblock = new TextBlock();
            Canvas            canvas    = new Canvas();

            canvas.HorizontalAlignment = HorizontalAlignment.Center;
            canvas.VerticalAlignment   = VerticalAlignment.Center;
            canvas.Children.Add(textblock);
            try
            {
                Grid grid2 = (Grid)progress.Template.FindName("grid", progress);
                grid2.Children.Add(canvas);
            }
            catch (Exception)
            {
            }

            //Border progressValue = progress.FindName("progressValue") as Border;

            progress.widthValue = (((progress.Value * 100) / progress.Range) * progress.Width) / 100;
            textblock.Text      = progress.Value + "";
            Console.WriteLine(textblock.Text);
        }
예제 #2
0
        public static void OnTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomProgressBar progress = sender as CustomProgressBar;

            progress.Style = Application.Current.FindResource(progress.Type) as Style;
        }