コード例 #1
0
ファイル: MyProcessBar.xaml.cs プロジェクト: ipoetry/ImPlayer
        private static void OnValueChanged2(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MyProcessBar g = d as MyProcessBar;

            if (g != null)
            {
                g.State.Visibility = (bool)e.NewValue ? Visibility.Visible : Visibility.Collapsed;
            }
            Console.WriteLine("ValueChanged new value is {0}", e.NewValue);
        }
コード例 #2
0
ファイル: MyProcessBar.xaml.cs プロジェクト: ipoetry/ImPlayer
                                        new PropertyMetadata(0d, new PropertyChangedCallback(OnValueChanged))); //属性默认值
        private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MyProcessBar g = d as MyProcessBar;

            if (g != null)
            {
                g.grid.Width = ((double)e.NewValue / 100d) * 180;
                Console.WriteLine("g.ActualWidth:" + g.ActualWidth);
                g.Process.Content = "%" + ((double)e.NewValue).ToString("F1");
            }
            Console.WriteLine("ValueChanged new value is {0}", e.NewValue);
        }