欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

WPF当本类依赖属性发生变化时触发回调函数PropertyChangeCallBackHandler

程序员文章站 2022-06-08 22:21:58
...
	//回调函数
        private static void TotalPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((PagingDataGrid)d).RaisePageChanged();
        }
        /// <summary>
        /// 依赖属性
        /// </summary>
        public static readonly DependencyProperty TotalProperty =
            DependencyProperty.Register(
            "Total", 
            typeof(int), 
            typeof(PagingDataGrid),
            new FrameworkPropertyMetadata(
                0, 
                FrameworkPropertyMetadataOptions.AffectsMeasure,
                new PropertyChangedCallback(TotalPropertyChanged))
            );